forked from ebhomengo/niki
1
0
Fork 0
niki/docs
Erfan Mohammadi 97908d31b1 docs(niki): update swagger api documentation 2024-08-27 21:19:34 +03:30
..
README.md feat(validator): implement unit test for admin login validator (#109) 2024-08-06 15:56:40 +03:30
config.md fix(niki): internal, validator and structure refactor 2024-08-03 14:37:16 +03:30
docs.go docs(niki): update swagger api documentation 2024-08-27 21:19:34 +03:30
mise.md feat(niki): add swagger not completed 2024-05-14 16:37:09 +03:30
swagger.json docs(niki): update swagger api documentation 2024-08-27 21:19:34 +03:30
swagger.yaml docs(niki): update swagger api documentation 2024-08-27 21:19:34 +03:30

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/