import { expect, nock, sinon } from '.'; describe('api', () => { it('exports expect', () => { expect(123).to.equal(123); }); it('exports nock', () => { expect(nock).to.be.an.instanceof(Function); }); it('export sinon', () => { expect(sinon.createSandbox).to.be.an.instanceof(Function); }); }); describe('sinon example', () => { it('stubs a method', () => { let count = 0; const api = { myMethod(arg: number) { return (count += 1); }, }; const stub = sinon.stub().returns(4); api.myMethod = stub; expect(api.myMethod(5)).to.eql(4); expect(count).to.eql(0); // Not changed because stub intercepted. expect(stub.calledWith(5)).to.eql(true); expect(stub.callCount).to.eql(1); }); });