Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it(runId, () => {
resetAll(SPIES);
const obj = objProvider();
const result = obj.myMethod(ORIGIN_ARGUMENT);
expect(SPIES.firstBefore).to.have.callCount(1).and.calledWith(sinon.match.same(obj), [ORIGIN_ARGUMENT]);
expect(SPIES.lastBefore).to.have.callCount(1).and.calledWith(sinon.match.same(obj), [ORIGIN_ARGUMENT + 1]);
expect(SPIES.superClassFunction).to.have.callCount(0);
expect(SPIES.childFunction).to.have.callCount(1).and.calledWith(sinon.match.same(obj), ORIGIN_ARGUMENT + 2);
expect(SPIES.firstAfter).to.have.callCount(1).and.calledWith(sinon.match.same(obj), ORIGIN_RESULT);
expect(SPIES.lastAfter).to.have.callCount(1).and.calledWith(sinon.match.same(obj), ORIGIN_RESULT + 1);
expect(result).to.equal(ORIGIN_RESULT + 2);
});
}
function checkClass(UserClass: typeof Base, spy3: sinon.SinonSpy) {
let obj = new UserClass(ORIGIN_ARGUMENT);
expect(obj.myNumber).to.equal(ORIGIN_ARGUMENT);
expect(first, 'first').to.have.callCount(1).and.calledWith([ORIGIN_ARGUMENT]);
expect(first, 'first').to.have.callCount(1).and.calledOn(sinon.match.same(obj));
expect(last, 'last').to.have.callCount(1).and.calledWith([ORIGIN_ARGUMENT]);
expect(last, 'last').to.have.callCount(1).and.calledOn(sinon.match.same(obj));
expect(spy3, 'userConstructorSpy').to.have.callCount(1).and.calledWith(sinon.match.same(obj));
expectSpyChain(
{n: 'first', c: first.firstCall},
{n: 'last', c: last.firstCall});
}