Answer the question
In order to leave comments, you need to log in
How can you swap a function call inside another function during testing?
Function example:
const getSomeData = require('path/to/file.js');
const someFunction = async () => {
const someRequestedData = await getSomeData(param1,param2);
// do something
return result;
};
module.exports = someFunction;
Answer the question
In order to leave comments, you need to log in
https://sinonjs.org/
https://scotch.io/tutorials/how-to-test-nodejs-app...
I don't really like jest, but everything is already there
https://jestjs.io/docs/en/mock-functions#mocking-m...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question