Though there is a same question here but I could not find answer to my problem so here goes my question:
I am testing my node js app using mocha and chai. I am usin
This error is due to not restoring the stub function properly. Use sandbox and then create the stub using the sandbox. After each test inside the suite, restore the sandbox
beforeEach(() => {
sandbox = sinon.createSandbox();
mockObj = sandbox.stub(testApp, 'getObj', fake_function)
});
afterEach(() => {
sandbox.restore();
});