forked from ebhomengo/niki
1
0
Fork 0
niki/docs
Ruhollah e727bf5c0e feat(niki): implement refresh access token for admins and benefactors (#156) 2024-09-15 15:04:11 +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 feat(niki): implement refresh access token for admins and benefactors (#156) 2024-09-15 15:04:11 +03:30
mise.md feat(niki): add swagger not completed 2024-05-14 16:37:09 +03:30
swagger.json feat(niki): implement refresh access token for admins and benefactors (#156) 2024-09-15 15:04:11 +03:30
swagger.yaml feat(niki): implement refresh access token for admins and benefactors (#156) 2024-09-15 15:04:11 +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/