I am using jasmine-node to test my node js and I am getting confuse with how to mock some stuff.
let's say this is my code under main.js:
var configFile = "config.json"
function readFile(){
fs.readFile(configFile, 'utf8', function(err, configData){
....
}
}
export.readFile = readFile
In my test file, I want to override the configFile param with my own configFile for testings
var main = require("../main.js");
describe("test with my own config file", function(){
it("check for ...", function(){
configFile = "otherConfigFile.json"
main.readFile();
}
}