mocks

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NotifierMock

type NotifierMock struct {
	// SendErrorFunc mocks the SendError method.
	SendErrorFunc func(ctx context.Context, summary string, err error, details map[string]interface{}) error
	// contains filtered or unexported fields
}

NotifierMock is a mock implementation of slack.Notifier.

func TestSomethingThatUsesNotifier(t *testing.T) {

	// make and configure a mocked slack.Notifier
	mockedNotifier := &NotifierMock{
		SendErrorFunc: func(ctx context.Context, summary string, err error, details map[string]interface{}) error {
			panic("mock out the SendError method")
		},
	}

	// use mockedNotifier in code that requires slack.Notifier
	// and then make assertions.

}

func (*NotifierMock) SendError

func (mock *NotifierMock) SendError(ctx context.Context, summary string, err error, details map[string]interface{}) error

SendError calls SendErrorFunc.

func (*NotifierMock) SendErrorCalls

func (mock *NotifierMock) SendErrorCalls() []struct {
	Ctx     context.Context
	Summary string
	Err     error
	Details map[string]interface{}
}

SendErrorCalls gets all the calls that were made to SendError. Check the length with:

len(mockedNotifier.SendErrorCalls())

type SlackClientMock

type SlackClientMock struct {
	// PostMessageFunc mocks the PostMessage method.
	PostMessageFunc func(channelID string, options ...slackslack.MsgOption) (string, string, error)
	// contains filtered or unexported fields
}

SlackClientMock is a mock implementation of disbundleapislack.SlackClient.

func TestSomethingThatUsesSlackClient(t *testing.T) {

	// make and configure a mocked disbundleapislack.SlackClient
	mockedSlackClient := &SlackClientMock{
		PostMessageFunc: func(channelID string, options ...slackslack.MsgOption) (string, string, error) {
			panic("mock out the PostMessage method")
		},
	}

	// use mockedSlackClient in code that requires disbundleapislack.SlackClient
	// and then make assertions.

}

func (*SlackClientMock) PostMessage

func (mock *SlackClientMock) PostMessage(channelID string, options ...slackslack.MsgOption) (string, string, error)

PostMessage calls PostMessageFunc.

func (*SlackClientMock) PostMessageCalls

func (mock *SlackClientMock) PostMessageCalls() []struct {
	ChannelID string
	Options   []slackslack.MsgOption
}

PostMessageCalls gets all the calls that were made to PostMessage. Check the length with:

len(mockedSlackClient.PostMessageCalls())

Jump to

Keyboard shortcuts

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