Javascript测试框架表示,为了测试异步函数,我需要在回调中添加done(),否则测试完成后函数将返回,因此测试将失败。我在我的package.json中添加了Jest,以及以下两个文件:function fetchData(cb) {If done() is never called, the test will fail,
我不知道如何在jest中模拟内部函数的返回值,我尝试了不同的方法。describe('countries list', () => { const mockFn = jest.mockerror with received value list of all countries instead of mocked one});
请建议我任何可能的