mocks

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClienterMock added in v1.12.0

type ClienterMock struct {
	// SendAlarmFunc mocks the SendAlarm method.
	SendAlarmFunc func(ctx context.Context, summary string, err error, details map[string]interface{}) error

	// SendInfoFunc mocks the SendInfo method.
	SendInfoFunc func(ctx context.Context, summary string, details map[string]interface{}) error

	// SendWarningFunc mocks the SendWarning method.
	SendWarningFunc func(ctx context.Context, summary string, details map[string]interface{}) error
	// contains filtered or unexported fields
}

ClienterMock is a mock implementation of slack.Clienter.

func TestSomethingThatUsesClienter(t *testing.T) {

	// make and configure a mocked slack.Clienter
	mockedClienter := &ClienterMock{
		SendAlarmFunc: func(ctx context.Context, summary string, err error, details map[string]interface{}) error {
			panic("mock out the SendAlarm method")
		},
		SendInfoFunc: func(ctx context.Context, summary string, details map[string]interface{}) error {
			panic("mock out the SendInfo method")
		},
		SendWarningFunc: func(ctx context.Context, summary string, details map[string]interface{}) error {
			panic("mock out the SendWarning method")
		},
	}

	// use mockedClienter in code that requires slack.Clienter
	// and then make assertions.

}

func (*ClienterMock) SendAlarm added in v1.12.0

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

SendAlarm calls SendAlarmFunc.

func (*ClienterMock) SendAlarmCalls added in v1.12.0

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

SendAlarmCalls gets all the calls that were made to SendAlarm. Check the length with:

len(mockedClienter.SendAlarmCalls())

func (*ClienterMock) SendInfo added in v1.12.0

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

SendInfo calls SendInfoFunc.

func (*ClienterMock) SendInfoCalls added in v1.12.0

func (mock *ClienterMock) SendInfoCalls() []struct {
	Ctx     context.Context
	Summary string
	Details map[string]interface{}
}

SendInfoCalls gets all the calls that were made to SendInfo. Check the length with:

len(mockedClienter.SendInfoCalls())

func (*ClienterMock) SendWarning added in v1.12.0

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

SendWarning calls SendWarningFunc.

func (*ClienterMock) SendWarningCalls added in v1.12.0

func (mock *ClienterMock) SendWarningCalls() []struct {
	Ctx     context.Context
	Summary string
	Details map[string]interface{}
}

SendWarningCalls gets all the calls that were made to SendWarning. Check the length with:

len(mockedClienter.SendWarningCalls())

Jump to

Keyboard shortcuts

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