Replies: 1 comment
-
In what way did it not work? Your example is not compilable so I cannot see your problem. After a quick read, I can however see a couple of potential problems: Don't make the mock call yourself, remove the calls to AssertCalled completely, and defer the calls to AssertExpectations: emailRepository.On("Create", mock.AnythingOfType("*entity.EmailResponse")).Return(emailResponse, nil)
defer emailRepository.AssertExpectations(t)
controllerService.On("Create", controllerRequest).Return(nil, nil)
defer controllerService.AssertExpectations(t)
smtpClient.On("Send", mock.AnythingOfType("*email.EmailRequest")).Return(nil)
defer smtpClient.AssertExpectations(t) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I have the golang test code and I need insert multiple mocks in code, what would it be the organization of mocks?
I put in this order, but didn't work. Can you help me?
Beta Was this translation helpful? Give feedback.
All reactions