本文整理匯總了TypeScript中Sinon.assert.callOrder方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript assert.callOrder方法的具體用法?TypeScript assert.callOrder怎麽用?TypeScript assert.callOrder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Sinon.assert
的用法示例。
在下文中一共展示了assert.callOrder方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it("check main flow", () => {
const AppProxy = Proxyquire("../app", {
express: Sinon.stub().returns(express),
});
const application = new AppProxy.Application();
const stubInitSessionManagement = Sinon.stub(application, "initSessionManagement");
const stubInitPassport = Sinon.stub(application, "initPassport");
const stubInitSessionFiltering = Sinon.stub(application, "initSessionFiltering");
const stubInitRestEndpoints = Sinon.stub(application, "initRestEndpoints");
const stubInitStaticContent = Sinon.stub(application, "initStaticContent");
const stubStartServer = Sinon.stub(application, "startServer");
application.initExpress();
stubInitSessionManagement.restore();
stubInitPassport.restore();
stubInitSessionFiltering.restore();
stubInitRestEndpoints.restore();
stubInitStaticContent.restore();
stubStartServer.restore();
Sinon.assert.callOrder(
stubInitSessionManagement.withArgs(express),
stubInitPassport.withArgs(express),
stubInitSessionFiltering.withArgs(express),
stubInitRestEndpoints.withArgs(express),
stubInitStaticContent.withArgs(express),
stubStartServer.withArgs(express),
);
});
示例2: test
test("mount should be called in ideal timing", (t) => {
const testNode3 = rootNode.children[0];
testNode3.enabled = true;
const order = [testComponent3Spy, testComponent2Spy, testComponentOptionalSpy, testComponent1Spy];
sinon.assert.callOrder(testComponent3Spy, testComponent2Spy, testComponentOptionalSpy, testComponent1Spy);
order.forEach(v => {
t.truthy(v.getCall(1).args[0] === "mount");
});
});
示例3: it
it('should preserve order and execute task in FIFO style', async () => {
const sequence = new Sequence(Symbol.for('seq'), seqConfig);
const spy1 = sinon.stub();
const spy2 = sinon.stub();
const spy3 = sinon.stub();
// This resolves in 5ms
sequence.addAndPromise(getPromiseWorker('1', false, 5, spy1));
// This resolves in 3ms
sequence.addAndPromise(getPromiseWorker('2', false, 3, spy2));
// This resolves in 1ms
await sequence.addAndPromise(getPromiseWorker('3', false, 1, spy3));
sinon.assert.callOrder(spy1, spy2, spy3);
});
示例4: createBeforeSpy
aspect.on(obj, 'method', aspectStub1);
aspect.on(obj, 'method', aspectStub2);
aspect.on(obj, 'method', aspectStub3);
assert.strictEqual(obj.method(0), 6);
assert.deepEqual(aspectStub1.lastCall.args, methodSpy.lastCall.args);
assert.deepEqual(aspectStub2.lastCall.args, methodSpy.lastCall.args);
assert.deepEqual(aspectStub3.lastCall.args, methodSpy.lastCall.args);
assert.isTrue(methodSpy.calledOnce);
assert.isTrue(aspectStub1.calledOnce);
assert.isTrue(aspectStub2.calledOnce);
assert.isTrue(aspectStub3.calledOnce);
sinon.assert.callOrder(methodSpy, aspectStub1, aspectStub2, aspectStub3);
}
},
'handle.destroy()': {
'prevents aspect from being called'() {
const aspectSpy = createBeforeSpy();
const handle = aspect.before(obj, 'method', aspectSpy);
obj.method(0);
assert.notEqual(obj.method, methodSpy);
handle.destroy();
obj.method(1);
assert.notEqual(obj.method, methodSpy);
assert.isTrue(methodSpy.calledTwice);
示例5: expect
previewManager.parseManifestFromActiveEditor(json).then(function (message) {
sinon.assert.callOrder(deserializeJSONStub, getReadMeStub);
expect(message).to.equal(success);
})