Let's assume I have the following test file:
import sinon from 'sinon';
function testFunction (param) {
const sum = param + 1;
}
describe('testFunction', () => {
it('increase the parameter value', () => {
const testFunctionSpy = sinon.spy(testFunction);
testFunctionSpy(2);
//expect sum to be equal 3
})
});
Is it possible to access the scope of the testFunction, the value of sum variable in particular?
Aucun commentaire:
Enregistrer un commentaire