testing

package
v0.0.0-...-5abe684 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsError

func IsError(t *testing.T, expected error, actual error) bool

IsError asserts error object

func IsOneOfErrors

func IsOneOfErrors(t *testing.T, expected []error, actual error) bool

IsOneOfErrors asserts error object

func MakeDuration

func MakeDuration(str string) domain.Duration

MakeDuration parses time.Duration

func MakeDurationPtr

func MakeDurationPtr(str string) *domain.Duration

MakeDurationPtr parses *time.Duration

func MakeIntPtr

func MakeIntPtr(value int) *int

MakeIntPtr returns *int

func MessagesEqual

func MessagesEqual(t *testing.T, expected []domain.Message, actual []domain.Message)

MessagesEqual compares list of Messages by it's content

func WithTextFile

func WithTextFile(t *testing.T, content string, f func(filename string))

WithTextFile creates temporary text file

Types

type ChannelProviderFunc

type ChannelProviderFunc func(id domain.ChannelID) (domain.Channel, error)

ChannelProviderFunc wraps function as ChannelProvider

func (ChannelProviderFunc) Get

Get implements ChannelProvider

func (ChannelProviderFunc) GetFileDescriptorPressure

func (f ChannelProviderFunc) GetFileDescriptorPressure() int

GetFileDescriptorPressure implements ChannelProvider

func (ChannelProviderFunc) JWTClockSkewLeewayMax

func (f ChannelProviderFunc) JWTClockSkewLeewayMax() domain.Duration

JWTClockSkewLeewayMax implements ChannelProvider

func (ChannelProviderFunc) Shutdown

func (f ChannelProviderFunc) Shutdown(ctx context.Context)

Shutdown closes ChannelProvider

type StubClock

type StubClock interface {
	Now() domain.Time

	Set(time time.Time)
	Add(d time.Duration) domain.Time
}

StubClock extends domain.SystemClock interface for testing purpose.

func NewStubClock

func NewStubClock(_ *testing.T) StubClock

NewStubClock creates new clock instance

Jump to

Keyboard shortcuts

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