My codes:
it('should delegate', sinon.test(function() {
const stub = sinon.stub(this.Ext, 'process');
// Question 1: should restore stub manually here?
// Question 2: what 'this' refer here?
}));
I am not sure whether the above code is OK or not. From this, maybe the following two pieces of codes are better?
it('should restore all mocks stubs and spies between tests', function() {
sinon.stub(some, 'method');
// Question 3: How to restore all mocks stubs and spies between tests?
// Question 4: what 'this' refer here?
}
it("should automatically restore all mocks stubs and spies", sinon.test(function() {
this.stub(some, 'method');
// Question 5: what 'this' refer here? test context?
}));
I am new to sinon. There are 5 questions in the above 3 pieces of codes. Any comments welcomed. Thanks