I am trying to test a function in a module. This function (I will call it function_a) calls another function (function_b) in the same file. Thus, this module is as follows:
module.exports.function_a = function (){
function_b()
};
module.exports.function_b = function_b = function () {
}
I need to check function_a function with concrete result of function_b function.
I would like to override the function_b function from my test file, and then call the file__ function from my test file, as a result, the function_a function calls this override function instead of the function_b function.
Just notice, I tried and succeeded in redefining functions from individual modules, such as this question, but that doesn't interest me.
, , , . , , .
that_module = require("that module")
that_module.function_b = function () { ...override ... }
that_module.function_a()
?