productstest

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MIT Imports: 4 Imported by: 0

README

productstest

This package should be named using [domain]test format, which is also used by standard package such as net/http/httptest.

If needed, this package may also contains additional function that act as helper for mocking (see product.go).

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Mock

func Mock(service *Service, funcs ...MockFunc)

Mock apply mock product functions.

Types

type MockFunc

type MockFunc func(service *Service)

MockFunc function.

func MockClear

func MockClear() MockFunc

MockClear util.

func MockCreate

func MockCreate(result products.Product, err error) MockFunc

MockCreate util.

func MockDelete

func MockDelete() MockFunc

MockDelete util.

func MockSearch

func MockSearch(result []products.Product, filter products.Filter, err error) MockFunc

MockSearch util.

func MockUpdate

func MockUpdate(result products.Product, err error) MockFunc

MockUpdate util.

type Service

type Service struct {
	mock.Mock
}

Service is an autogenerated mock type for the Service type

func NewService

func NewService(t interface {
	mock.TestingT
	Cleanup(func())
}) *Service

NewService creates a new instance of Service. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*Service) Create

func (_m *Service) Create(ctx context.Context, product *products.Product) error

Create provides a mock function with given fields: ctx, product

func (*Service) Delete

func (_m *Service) Delete(ctx context.Context, product *products.Product)

Delete provides a mock function with given fields: ctx, product

func (*Service) Search

func (_m *Service) Search(ctx context.Context, _a1 *[]products.Product, filter products.Filter) error

Search provides a mock function with given fields: ctx, _a1, filter

func (*Service) Update

func (_m *Service) Update(ctx context.Context, product *products.Product, changes rel.Changeset) error

Update provides a mock function with given fields: ctx, product, changes

Jump to

Keyboard shortcuts

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