moq

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UseCaseMock

type UseCaseMock struct {
	// CreateAuthUserFunc mocks the CreateAuthUser method.
	CreateAuthUserFunc func(ctx context.Context, f *firestore.Client, input *model.NewAuthUser, u *repository.User, mu *model.AuthUser) (string, error)

	// DeleteAuthUserFunc mocks the DeleteAuthUser method.
	DeleteAuthUserFunc func(ctx context.Context, f *firestore.Client, uid string) error
	// contains filtered or unexported fields
}

UseCaseMock is a mock implementation of auth.UseCase.

func TestSomethingThatUsesUseCase(t *testing.T) {

	// make and configure a mocked auth.UseCase
	mockedUseCase := &UseCaseMock{
		CreateAuthUserFunc: func(ctx context.Context, f *firestore.Client, input *model.NewAuthUser, u *repository.User, mu *model.AuthUser) (string, error) {
			panic("mock out the CreateAuthUser method")
		},
		DeleteAuthUserFunc: func(ctx context.Context, f *firestore.Client, uid string) error {
			panic("mock out the DeleteAuthUser method")
		},
	}

	// use mockedUseCase in code that requires auth.UseCase
	// and then make assertions.

}

func (*UseCaseMock) CreateAuthUser

func (mock *UseCaseMock) CreateAuthUser(ctx context.Context, f *firestore.Client, input *model.NewAuthUser, u *repository.User, mu *model.AuthUser) (string, error)

CreateAuthUser calls CreateAuthUserFunc.

func (*UseCaseMock) CreateAuthUserCalls

func (mock *UseCaseMock) CreateAuthUserCalls() []struct {
	Ctx   context.Context
	F     *firestore.Client
	Input *model.NewAuthUser
	U     *repository.User
	Mu    *model.AuthUser
}

CreateAuthUserCalls gets all the calls that were made to CreateAuthUser. Check the length with:

len(mockedUseCase.CreateAuthUserCalls())

func (*UseCaseMock) DeleteAuthUser

func (mock *UseCaseMock) DeleteAuthUser(ctx context.Context, f *firestore.Client, uid string) error

DeleteAuthUser calls DeleteAuthUserFunc.

func (*UseCaseMock) DeleteAuthUserCalls

func (mock *UseCaseMock) DeleteAuthUserCalls() []struct {
	Ctx context.Context
	F   *firestore.Client
	UID string
}

DeleteAuthUserCalls gets all the calls that were made to DeleteAuthUser. Check the length with:

len(mockedUseCase.DeleteAuthUserCalls())

Jump to

Keyboard shortcuts

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