forked from ebhomengo/niki
Ruhollah e727bf5c0e | ||
---|---|---|
.. | ||
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/