How to mock jQuery .done() so it executes correctly with Jest?
问题 I'm trying to write a unit-test for a password changing React-module, but i can't get the code to be executed in brackets. I've written a mock for the module MyAPI, the mock code is executed just fine and with console.log("something") i can see the output in console. However, i can't get the code to run after the .done(function (data). It's most likely because the mock is replacing those with it's own code. I know one option is to use a fake server like Nock, but I wouldn't want to turn it