本文整理汇总了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);
})