I have an use case method that call a mocked repository method two times with a different parameter
I've written it somewhat like this
func TestInitUserSubscription(t *testing.T) {
aRepository := &aRepositoryMock{}
//this expected method is called twice
aRepository.On("GetByID", data.ID).Return(*data, nil)
bUseCase := New(
aRepository,
)
result, err := bUseCase.Init(data.Name)
}
running the test, results in these following error
mock: Unexpected Method Call
-----------------------------
GetByID(uint64)
0: 0x0
The closest call I have is:
GetByID(uint64)
0: 0x1
Diff: 0: FAIL: (uint64=0) != (uint64=1) [recovered]
panic:
mock: Unexpected Method Call
-----------------------------
GetByID(uint64)
0: 0x0
The closest call I have is:
GetByID(uint64)
0: 0x1
Diff: 0: FAIL: (uint64=0) != (uint64=1)
I'm assuming this is because the the method is called with different parameter, I've tried to use .Twice()
but didn't solve the problem
Helps would be very much appreciated