alkshmir / go-openai-discord

golang implementation of OpenAI chatbot as discord bot
Apache License 2.0
0 stars 0 forks source link

Mock openai.Client #4

Closed alkshmir closed 6 months ago

alkshmir commented 6 months ago

To test the behavior of the chat bot, we may have to apply a mock of openai.Client. I have no idea how sashabaranov/go-openai provide mocking features. Without mocking, the chatbot is completely untestable.

alkshmir commented 6 months ago

https://github.com/sashabaranov/go-openai/blob/c6a63ed19aeb0e91facc5409c5a08612db550fb2/client.go#L16-L21

Client is struct but ClientConfig, utils.RequestBuilder is interfaces and createFormBuilder is a function type, thus it can be probably mocked.