forked from ebhomengo/niki
Ruhollah fb4bd97c5c | ||
---|---|---|
.. | ||
README.md | ||
config.md | ||
docs.go | ||
mise.md | ||
swagger.json | ||
swagger.yaml |
README.md
Mocking interfaces in unit tests
1- add a //go:generate directive above the interface:
//go:generate mockery --name Repository
type Repository interface {
AdminExistByPhoneNumber(ctx context.Context, phoneNumber string) (bool, error)
AdminExistByEmail(ctx context.Context, email string) (bool, error)
}
2- run go generate to create the mock files:
go generate ./...
3- use the generated mock types in your tests.
for more information visit: https://vektra.github.io/mockery/latest/