I've noticed we got the same behavior when we jest.fn() with the implementation passed as param in the .fn() and jest.fn().mockImplementation(). If so, choosing the fit is jut a matter of tastes?
Example:
jest.fn((num1, num2) => num1 + num2)
// same as
jest.fn().mockImplementation((num1, num2) => num1 + num2)
Does anyone have some thoughts?
jest.fn(implementation) is a shorthand for jest.fn().mockImplementation(implementation)
Not much to think about :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With