You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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.
Update the basic_query function signature to accept a ChatGPTClient object as a parameter.
Update the test module to use the MockChatGPTClient for testing the basic_query function.
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.
The text was updated successfully, but these errors were encountered:
Description
To improve the testability of the
basic_query
function in theChatGPT
module, we need to refactor it to accept aChatGPTClient
object. This will enable the use of a mock client during testing, while the actual client will be used during normal usage.Tasks
Create a
MockChatGPTClient
struct that implements theChatGPTClient
trait. The mock client should return pre-defined responses for testing purposes instead of making actual API calls.Update the
basic_query
function signature to accept aChatGPTClient
object as a parameter.Update the test module to use the
MockChatGPTClient
for testing thebasic_query
function.Update the
main.rs
file to pass the default client when calling thebasic_query
function.Acceptance Criteria
basic_query
function accepts aChatGPTClient
object as a parameter.MockChatGPTClient
struct is implemented for testing purposes.basic_query
function is added that uses theMockChatGPTClient
.main.rs
file is updated to pass the default client when callingbasic_query
.The text was updated successfully, but these errors were encountered: