79328421

Date: 2025-01-04 07:37:51
Score: 1.5
Natty:
Report link

I think two points are valid for this question. First, as the Jest documentation explains, jest.spyOn also calls the spied method, so a custom implementation needs to be provided. And second, a helper function is easier to mock if it is in a different file. If not, the tested function will look first for the helper in the same file, instead of the mocked one. This was explained here: https://stackoverflow.com/a/52318294/7478816

Reasons:
  • Blacklisted phrase (1): stackoverflow
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Adriel Zarate