I write a unit-test for doB
function of my module.
I want to stub the function doA
without exporting it, I prefer not change the way doB
accesses doA
.
I understand that it cannot be simply stub
ed because it isnt in the exported object.
How do I stub doA
(sinon
or any other tool?)
function doA (value) {
/* do stuff */
}
function doB (value) {
let resultA = doA(value);
if (resultA === 'something') {
/* do some */
} else {
/* do otherwise */
}
}
module.exports = exports = {
doB
}