79764062

Date: 2025-09-14 02:40:31
Score: 0.5
Natty:
Report link

It looks like you're spying on a method that isn't actually implemented. You have spy(hashPassword, "thisThingEitherDoesntExistOrDoesntReferenceAnything")

The first argument is fine, because it references the class. The second argument should be the name of the function. The nuance here is that the function you're intending to mock is the constructor of the hashPassword class.

Whether or not you can actually do this without a workaround is beyond my depth of js knowledge, but you can search for something like below

See How to spy on a class constructor jest?, or search for mocking constructors

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (0.5):
Posted by: Kevin Price