Closed mcbain closed 3 years ago
Did you figure it out?
No, but no time to really dig into it. We end up using the longer form which is even more readable :)
Figured it out... it's because calledWith needs to be explicit since v3, you must define all args passed to the function. Partial definitions of args are no longer supported. And when you map the function gets passed value, index, array
, not just the value
. So it wasn't a match.
You would have to change your code a bit:
when(makeFoo)
.calledWith('bar', expect.anything(), expect.anything())
.mockReturnValue(123)
Any idea why the short form mocking does not work with 3.2 ?