Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PolicyMock ¶
type PolicyMock struct { // QueryFunc mocks the Query method. QueryFunc func(ctx context.Context, query string, input any, output any, options ...opac.QueryOption) error // contains filtered or unexported fields }
PolicyMock is a mock implementation of interfaces.Policy.
func TestSomethingThatUsesPolicy(t *testing.T) { // make and configure a mocked interfaces.Policy mockedPolicy := &PolicyMock{ QueryFunc: func(ctx context.Context, query string, input any, output any, options ...opac.QueryOption) error { panic("mock out the Query method") }, } // use mockedPolicy in code that requires interfaces.Policy // and then make assertions. }
func (*PolicyMock) Query ¶
func (mock *PolicyMock) Query(ctx context.Context, query string, input any, output any, options ...opac.QueryOption) error
Query calls QueryFunc.
func (*PolicyMock) QueryCalls ¶
func (mock *PolicyMock) QueryCalls() []struct { Ctx context.Context Query string Input any Output any Options []opac.QueryOption }
QueryCalls gets all the calls that were made to Query. Check the length with:
len(mockedPolicy.QueryCalls())
type SlackMock ¶
type SlackMock struct { // PostMessageContextFunc mocks the PostMessageContext method. PostMessageContextFunc func(ctx context.Context, channelID string, options ...slack.MsgOption) (string, string, error) // contains filtered or unexported fields }
SlackMock is a mock implementation of interfaces.Slack.
func TestSomethingThatUsesSlack(t *testing.T) { // make and configure a mocked interfaces.Slack mockedSlack := &SlackMock{ PostMessageContextFunc: func(ctx context.Context, channelID string, options ...slack.MsgOption) (string, string, error) { panic("mock out the PostMessageContext method") }, } // use mockedSlack in code that requires interfaces.Slack // and then make assertions. }
func (*SlackMock) PostMessageContext ¶
func (mock *SlackMock) PostMessageContext(ctx context.Context, channelID string, options ...slack.MsgOption) (string, string, error)
PostMessageContext calls PostMessageContextFunc.
func (*SlackMock) PostMessageContextCalls ¶
func (mock *SlackMock) PostMessageContextCalls() []struct { Ctx context.Context ChannelID string Options []slack.MsgOption }
PostMessageContextCalls gets all the calls that were made to PostMessageContext. Check the length with:
len(mockedSlack.PostMessageContextCalls())
type UseCasesMock ¶
type UseCasesMock struct { // HandleMessageFunc mocks the HandleMessage method. HandleMessageFunc func(ctx context.Context, schema types.Schema, input *model.MessageQueryInput) error // contains filtered or unexported fields }
UseCasesMock is a mock implementation of interfaces.UseCases.
func TestSomethingThatUsesUseCases(t *testing.T) { // make and configure a mocked interfaces.UseCases mockedUseCases := &UseCasesMock{ HandleMessageFunc: func(ctx context.Context, schema types.Schema, input *model.MessageQueryInput) error { panic("mock out the HandleMessage method") }, } // use mockedUseCases in code that requires interfaces.UseCases // and then make assertions. }
func (*UseCasesMock) HandleMessage ¶
func (mock *UseCasesMock) HandleMessage(ctx context.Context, schema types.Schema, input *model.MessageQueryInput) error
HandleMessage calls HandleMessageFunc.
func (*UseCasesMock) HandleMessageCalls ¶
func (mock *UseCasesMock) HandleMessageCalls() []struct { Ctx context.Context Schema types.Schema Input *model.MessageQueryInput }
HandleMessageCalls gets all the calls that were made to HandleMessage. Check the length with:
len(mockedUseCases.HandleMessageCalls())
Click to show internal directories.
Click to hide internal directories.