当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript assert.callOrder方法代码示例

本文整理汇总了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),
            );
        });
开发者ID:YuriyGorvitovskiy,项目名称:Taskenize,代码行数:30,代码来源:app.ts

示例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");
  });
});
开发者ID:emadurandal,项目名称:GrimoireJS,代码行数:9,代码来源:GomlNode2Test.ts

示例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);
 });
开发者ID:RiseVision,项目名称:rise-node,代码行数:13,代码来源:sequence.spec.ts

示例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);
开发者ID:dylans,项目名称:core,代码行数:31,代码来源:aspect.ts

示例5: expect

            previewManager.parseManifestFromActiveEditor(json).then(function (message) {

                sinon.assert.callOrder(deserializeJSONStub, getReadMeStub);
                expect(message).to.equal(success);
            })
开发者ID:Microsoft,项目名称:extension-manifest-editor,代码行数:5,代码来源:TestPreviewManager.ts


注:本文中的Sinon.assert.callOrder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。