Open
Description
We are seeing examples likes this
// BAD
example.mockImplementation(() => value);
Rather than just
// GOOD
example.mockReturnValue(value);
This seems to be a sound change to make when
value
is a literal primitive e.g.true
- A
const
primitive value
In more complex values using mockImplementation
may be approprate, e.g. the result is deferred or closures a var etc
// OK
example.mockImplementation(() => new Date());
// NOT THE SAME
example.mockReturnValue(new Date());
Metadata
Metadata
Assignees
Labels
No labels