Reputation: 1351
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?
Upvotes: 8
Views: 496
Reputation: 4643
jest.fn(implementation)
is a shorthand for jest.fn().mockImplementation(implementation)
Not much to think about :)
Upvotes: 13