Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor basic_query to support testing with a mock client #41

Open
DieHard073055 opened this issue May 4, 2023 · 0 comments
Open

Refactor basic_query to support testing with a mock client #41

DieHard073055 opened this issue May 4, 2023 · 0 comments
Assignees

Comments

@DieHard073055
Copy link
Owner

Description

To improve the testability of the basic_query function in the ChatGPT module, we need to refactor it to accept a ChatGPTClient object. This will enable the use of a mock client during testing, while the actual client will be used during normal usage.

Tasks

  1. Create a MockChatGPTClient struct that implements the ChatGPTClient trait. The mock client should return pre-defined responses for testing purposes instead of making actual API calls.

  2. Update the basic_query function signature to accept a ChatGPTClient object as a parameter.

  3. Update the test module to use the MockChatGPTClient for testing the basic_query function.

  4. Update the main.rs file to pass the default client when calling the basic_query function.

Acceptance Criteria

  • The basic_query function accepts a ChatGPTClient object as a parameter.
  • A MockChatGPTClient struct is implemented for testing purposes.
  • A test for basic_query function is added that uses the MockChatGPTClient.
  • The main.rs file is updated to pass the default client when calling basic_query.
@DieHard073055 DieHard073055 self-assigned this May 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant