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
Describe the feature or improvement you're requesting
At the moment, it is difficult to effectively mock our OpenAi class in unit tests because we are currently forced to pass in the API key as an argument during instantiation like so:
newOpenAi(getenv('OPENAI_API_KEY'));
I'm proposing a new setApiKey method that will enable us do this anytime so that we are not restricted to the constructor. In this way, we can create and pass our objects via dependency injection like so:
Describe the feature or improvement you're requesting
At the moment, it is difficult to effectively mock our OpenAi class in unit tests because we are currently forced to pass in the API key as an argument during instantiation like so:
I'm proposing a new
setApiKey
method that will enable us do this anytime so that we are not restricted to the constructor. In this way, we can create and pass our objects via dependency injection like so:Additional context
In this way, we should be able to easily mock our OpenAi class for use in unit tests like so:
The text was updated successfully, but these errors were encountered: