I am pretty new in Jasmine test.
Lett say I have this sample.js file:
(function() {
function myFunction() {
do some thing and then make a call to MyOtherFunciton
}
myOtherFunciton(p1, p2, p3) {
//do some stuff in here
}
module.exports = {
myOtherFunciton,
myFunction
}
})();
Now I have this jasmine test does the following
const mySampleFile = require(./sample.js);
spyOn(mySampleFile, "myOtherFunciton").and.callFack(()=>{
});
mySampleFile.myFunction();
expect(mySampleFile.myOtherFunciton).toHaveBeenCalled();
The problem I am experiencing is that it makes a call to real myOtherFunciton function but not the mocked one. Why is that ?