我的代码:
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?
}));
我不确定上面的代码是否正常。从this,可能以下两段代码更好?
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?
}));
我是sinon的新手。上述3个代码中有5个问题。欢迎任何评论。感谢