mocks

package
v1.9.3 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: Apache-2.0 Imports: 2 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 {
	// SendFunc mocks the Send method.
	SendFunc func(ctx context.Context, destination string, text string) error
	// contains filtered or unexported fields
}

NotifierMock is a mock implementation of email.Notifier.

func TestSomethingThatUsesNotifier(t *testing.T) {

	// make and configure a mocked email.Notifier
	mockedNotifier := &NotifierMock{
		SendFunc: func(ctx context.Context, destination string, text string) error {
			panic("mock out the Send method")
		},
	}

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

}

func (*NotifierMock) Send

func (mock *NotifierMock) Send(ctx context.Context, destination string, text string) error

Send calls SendFunc.

func (*NotifierMock) SendCalls

func (mock *NotifierMock) SendCalls() []struct {
	Ctx         context.Context
	Destination string
	Text        string
}

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

len(mockedNotifier.SendCalls())

Jump to

Keyboard shortcuts

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