mocks

package
v0.0.0-...-4c96ec7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BotAPIMock

type BotAPIMock struct {
	// SendFunc mocks the Send method.
	SendFunc func(c tbapi.Chattable) (tbapi.Message, error)
	// contains filtered or unexported fields
}

BotAPIMock is a mock implementation of sender.BotAPI.

func TestSomethingThatUsesBotAPI(t *testing.T) {

	// make and configure a mocked sender.BotAPI
	mockedBotAPI := &BotAPIMock{
		SendFunc: func(c tbapi.Chattable) (tbapi.Message, error) {
			panic("mock out the Send method")
		},
	}

	// use mockedBotAPI in code that requires sender.BotAPI
	// and then make assertions.

}

func (*BotAPIMock) ResetCalls

func (mock *BotAPIMock) ResetCalls()

ResetCalls reset all the calls that were made to all mocked methods.

func (*BotAPIMock) ResetSendCalls

func (mock *BotAPIMock) ResetSendCalls()

ResetSendCalls reset all the calls that were made to Send.

func (*BotAPIMock) Send

func (mock *BotAPIMock) Send(c tbapi.Chattable) (tbapi.Message, error)

Send calls SendFunc.

func (*BotAPIMock) SendCalls

func (mock *BotAPIMock) SendCalls() []struct {
	C tbapi.Chattable
}

SendCalls gets all the calls that were made to Send. Check the length with:

len(mockedBotAPI.SendCalls())

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL