forked from ebhomengo/niki
Iman Mirazimi 4ef5c0ed66 | ||
---|---|---|
adapter | ||
config | ||
contract/sms | ||
delivery/http_server | ||
deploy | ||
docs | ||
entity | ||
logger | ||
param | ||
pkg | ||
repository | ||
service | ||
validator | ||
vendor | ||
.env.example | ||
.gitignore | ||
.golangci.yml | ||
.mise.toml | ||
.mockery.yaml | ||
Dockerfile | ||
Makefile | ||
config.yml | ||
docker-compose.yaml | ||
go.mod | ||
go.sum | ||
main.go |
docs/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/