Documentation ¶
Overview ¶
Package btest implements a script test system for the bot package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Sender ¶
Sender sends a single message back via an origin (bot name) to the specified target (channel).
type SenderMock ¶
type SenderMock struct { // SendMessageFunc mocks the SendMessage method. SendMessageFunc func(ctx context.Context, origin string, target string, message string) error // contains filtered or unexported fields }
SenderMock is a mock implementation of Sender.
func TestSomethingThatUsesSender(t *testing.T) { // make and configure a mocked Sender mockedSender := &SenderMock{ SendMessageFunc: func(ctx context.Context, origin string, target string, message string) error { panic("mock out the SendMessage method") }, } // use mockedSender in code that requires Sender // and then make assertions. }
func (*SenderMock) SendMessage ¶
func (mock *SenderMock) SendMessage(ctx context.Context, origin string, target string, message string) error
SendMessage calls SendMessageFunc.
func (*SenderMock) SendMessageCalls ¶
func (mock *SenderMock) SendMessageCalls() []struct { Ctx context.Context Origin string Target string Message string }
SendMessageCalls gets all the calls that were made to SendMessage. Check the length with:
len(mockedSender.SendMessageCalls())
Click to show internal directories.
Click to hide internal directories.