mock

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AreaStoreMock

type AreaStoreMock struct {
	// CheckerFunc mocks the Checker method.
	CheckerFunc func(contextMoqParam context.Context, checkState *healthcheck.CheckState) error

	// CloseFunc mocks the Close method.
	CloseFunc func(ctx context.Context) error

	// GetAreaFunc mocks the GetArea method.
	GetAreaFunc func(ctx context.Context, id string) (*models.Area, error)

	// GetAreasFunc mocks the GetAreas method.
	GetAreasFunc func(ctx context.Context, offset int, limit int) (*models.AreasResults, error)

	// GetVersionFunc mocks the GetVersion method.
	GetVersionFunc func(ctx context.Context, id string, versionID int) (*models.Area, error)
	// contains filtered or unexported fields
}

AreaStoreMock is a mock implementation of api.AreaStore.

func TestSomethingThatUsesAreaStore(t *testing.T) {

	// make and configure a mocked api.AreaStore
	mockedAreaStore := &AreaStoreMock{
		CheckerFunc: func(contextMoqParam context.Context, checkState *healthcheck.CheckState) error {
			panic("mock out the Checker method")
		},
		CloseFunc: func(ctx context.Context) error {
			panic("mock out the Close method")
		},
		GetAreaFunc: func(ctx context.Context, id string) (*models.Area, error) {
			panic("mock out the GetArea method")
		},
		GetAreasFunc: func(ctx context.Context, offset int, limit int) (*models.AreasResults, error) {
			panic("mock out the GetAreas method")
		},
		GetVersionFunc: func(ctx context.Context, id string, versionID int) (*models.Area, error) {
			panic("mock out the GetVersion method")
		},
	}

	// use mockedAreaStore in code that requires api.AreaStore
	// and then make assertions.

}

func (*AreaStoreMock) Checker

func (mock *AreaStoreMock) Checker(contextMoqParam context.Context, checkState *healthcheck.CheckState) error

Checker calls CheckerFunc.

func (*AreaStoreMock) CheckerCalls

func (mock *AreaStoreMock) CheckerCalls() []struct {
	ContextMoqParam context.Context
	CheckState      *healthcheck.CheckState
}

CheckerCalls gets all the calls that were made to Checker. Check the length with:

len(mockedAreaStore.CheckerCalls())

func (*AreaStoreMock) Close

func (mock *AreaStoreMock) Close(ctx context.Context) error

Close calls CloseFunc.

func (*AreaStoreMock) CloseCalls

func (mock *AreaStoreMock) CloseCalls() []struct {
	Ctx context.Context
}

CloseCalls gets all the calls that were made to Close. Check the length with:

len(mockedAreaStore.CloseCalls())

func (*AreaStoreMock) GetArea

func (mock *AreaStoreMock) GetArea(ctx context.Context, id string) (*models.Area, error)

GetArea calls GetAreaFunc.

func (*AreaStoreMock) GetAreaCalls

func (mock *AreaStoreMock) GetAreaCalls() []struct {
	Ctx context.Context
	ID  string
}

GetAreaCalls gets all the calls that were made to GetArea. Check the length with:

len(mockedAreaStore.GetAreaCalls())

func (*AreaStoreMock) GetAreas

func (mock *AreaStoreMock) GetAreas(ctx context.Context, offset int, limit int) (*models.AreasResults, error)

GetAreas calls GetAreasFunc.

func (*AreaStoreMock) GetAreasCalls

func (mock *AreaStoreMock) GetAreasCalls() []struct {
	Ctx    context.Context
	Offset int
	Limit  int
}

GetAreasCalls gets all the calls that were made to GetAreas. Check the length with:

len(mockedAreaStore.GetAreasCalls())

func (*AreaStoreMock) GetVersion

func (mock *AreaStoreMock) GetVersion(ctx context.Context, id string, versionID int) (*models.Area, error)

GetVersion calls GetVersionFunc.

func (*AreaStoreMock) GetVersionCalls

func (mock *AreaStoreMock) GetVersionCalls() []struct {
	Ctx       context.Context
	ID        string
	VersionID int
}

GetVersionCalls gets all the calls that were made to GetVersion. Check the length with:

len(mockedAreaStore.GetVersionCalls())

Jump to

Keyboard shortcuts

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