Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add callback functionality #116

Open
roytouw7 opened this issue Feb 26, 2024 · 0 comments
Open

Add callback functionality #116

roytouw7 opened this issue Feb 26, 2024 · 0 comments

Comments

@roytouw7
Copy link

Using Mockery there is the option to register a callback function which will get triggered upon hitting the mock, in our unit tests we use this to have the unit test wait for some mocks to get hit which happen in a detached go routine, this way we do not have to add any arbitrary time.Sleep in the tests. The Mockery example is listed below, it would be nice if this would also be possible in Gock.

test.reservationEmailService.
  On("SendConfirmationEmail", mock.Anything, &reservationModels.ConfirmationRequest{GUID: "123456", Language: ""}).
  Return(fmt.Errorf("email error")).
  Once().
  Run(callback)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant