當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。