emailmock

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package emailmock provides mock implementations of the email package's interfaces. Both the hand-written testify-based Emailer type and the moq-generated EmailerMock type live here during the testify → moq migration. New test code should prefer the moq-generated types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EmailerMock

type EmailerMock struct {
	// SendEmailFunc mocks the SendEmail method.
	SendEmailFunc func(ctx context.Context, details *email.OutboundEmailMessage) error
	// contains filtered or unexported fields
}

EmailerMock is a mock implementation of email.Emailer.

func TestSomethingThatUsesEmailer(t *testing.T) {

	// make and configure a mocked email.Emailer
	mockedEmailer := &EmailerMock{
		SendEmailFunc: func(ctx context.Context, details *email.OutboundEmailMessage) error {
			panic("mock out the SendEmail method")
		},
	}

	// use mockedEmailer in code that requires email.Emailer
	// and then make assertions.

}

func (*EmailerMock) SendEmail

func (mock *EmailerMock) SendEmail(ctx context.Context, details *email.OutboundEmailMessage) error

SendEmail calls SendEmailFunc.

func (*EmailerMock) SendEmailCalls

func (mock *EmailerMock) SendEmailCalls() []struct {
	Ctx     context.Context
	Details *email.OutboundEmailMessage
}

SendEmailCalls gets all the calls that were made to SendEmail. Check the length with:

len(mockedEmailer.SendEmailCalls())

Jump to

Keyboard shortcuts

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