telemock

package
v0.0.0-...-95b083d Latest Latest
Warning

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

Go to latest
Published: May 17, 2023 License: Unlicense Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NotifyMock

type NotifyMock struct {
	// PushNotifyFunc mocks the PushNotify method.
	PushNotifyFunc func(ctx context.Context, chatId int64, message string) error

	// StopFunc mocks the Stop method.
	StopFunc func()
	// contains filtered or unexported fields
}

NotifyMock is a mock implementation of telegram.Notify.

func TestSomethingThatUsesNotify(t *testing.T) {

	// make and configure a mocked telegram.Notify
	mockedNotify := &NotifyMock{
		PushNotifyFunc: func(ctx context.Context, chatId int64, message string) error {
			panic("mock out the PushNotify method")
		},
		StopFunc: func()  {
			panic("mock out the Stop method")
		},
	}

	// use mockedNotify in code that requires telegram.Notify
	// and then make assertions.

}

func (*NotifyMock) PushNotify

func (mock *NotifyMock) PushNotify(ctx context.Context, chatId int64, message string) error

PushNotify calls PushNotifyFunc.

func (*NotifyMock) PushNotifyCalls

func (mock *NotifyMock) PushNotifyCalls() []struct {
	Ctx     context.Context
	ChatId  int64
	Message string
}

PushNotifyCalls gets all the calls that were made to PushNotify. Check the length with:

len(mockedNotify.PushNotifyCalls())

func (*NotifyMock) Stop

func (mock *NotifyMock) Stop()

Stop calls StopFunc.

func (*NotifyMock) StopCalls

func (mock *NotifyMock) StopCalls() []struct {
}

StopCalls gets all the calls that were made to Stop. Check the length with:

len(mockedNotify.StopCalls())

Jump to

Keyboard shortcuts

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