Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AiService ¶
type AiService interface {
Chat(ctx context.Context, request *client.ChatRequest) (*client.ChatResponse, error)
}
type AiServiceImpl ¶
type AiServiceImpl struct {
// contains filtered or unexported fields
}
func NewAiService ¶
func NewAiService(cfg *config.Config, clients map[string]client.ChatClient, logger *zap.SugaredLogger) (*AiServiceImpl, error)
func (*AiServiceImpl) Chat ¶
func (ai *AiServiceImpl) Chat(ctx context.Context, request *client.ChatRequest) (*client.ChatResponse, error)
type AiServiceMock ¶
type AiServiceMock struct {
// ChatFunc mocks the Chat method.
ChatFunc func(ctx context.Context, request *client.ChatRequest) (*client.ChatResponse, error)
// contains filtered or unexported fields
}
AiServiceMock is a mock implementation of AiService.
func TestSomethingThatUsesAiService(t *testing.T) {
// make and configure a mocked AiService
mockedAiService := &AiServiceMock{
ChatFunc: func(ctx context.Context, request *client.ChatRequest) (*client.ChatResponse, error) {
panic("mock out the Chat method")
},
}
// use mockedAiService in code that requires AiService
// and then make assertions.
}
func (*AiServiceMock) Chat ¶
func (mock *AiServiceMock) Chat(ctx context.Context, request *client.ChatRequest) (*client.ChatResponse, error)
Chat calls ChatFunc.
func (*AiServiceMock) ChatCalls ¶
func (mock *AiServiceMock) ChatCalls() []struct { Ctx context.Context Request *client.ChatRequest }
ChatCalls gets all the calls that were made to Chat. Check the length with:
len(mockedAiService.ChatCalls())
Click to show internal directories.
Click to hide internal directories.