當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Sinon.restore函數代碼示例

本文整理匯總了TypeScript中Sinon.restore函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript restore函數的具體用法?TypeScript restore怎麽用?TypeScript restore使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了restore函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: it

 it("should extract intervals", () => {
     const c1 = minisync.from({a: [{o: 1}, {o: 2}, {o: 3}]});
     const c2 = minisync.from(c1.getChanges());
     c1.get("a").splice(2, 0, 3, 4);
     c1.get("a").splice(1, 0, 1, 2);
     c1.get("a").push(5);
     // c1 = {a: [{o:1},1,2,{o:2},3,4,{o:3},5]}
     // note that empty intervals are not merged,
     // so there is no interval before the first object
     const expectedIntervals = [
         {after: c2.get("a[0]").getID(), before: c2.get("a[1]").getID(), values: [1, 2]},
         {after: c2.get("a[1]").getID(), before: c2.get("a[2]").getID(), values: [3, 4]},
         {after: c2.get("a[2]").getID(), before: null, values: [5]}
     ];
     let expectedIntervalIndex = 0;
     sinon.replace(SyncableArray.prototype, "mergeInterval",
         (interval: any) => {
             const expectedInterval = expectedIntervals[expectedIntervalIndex++];
             compareObjects(interval, expectedInterval);
         }
     );
     c2.mergeChanges(c1.getChanges());
     expect(expectedIntervalIndex).to.equal(3);
     sinon.restore();
 });
開發者ID:jsebrech,項目名稱:minisync,代碼行數:25,代碼來源:syncable.spec.ts

示例2: it

 it('should read transaction recipients from txPrebuild even if none are specified as top-level params', co(function *() {
   sinon.stub(Util, 'xprvToEthPrivateKey');
   sinon.stub(Util, 'ethSignMsgHash');
   sinon.stub(ethWallet.getOperationSha3ForExecuteAndConfirm);
   const { halfSigned } = yield ethWallet.signTransaction({ txPrebuild: tx, prv: 'my_user_prv' });
   halfSigned.should.have.property('recipients', recipients);
   sinon.restore();
 }));
開發者ID:BitGo,項目名稱:BitGoJS,代碼行數:8,代碼來源:ethWallet.ts

示例3: it

        it('should pass through and call createNewBusinessDefinition from common', inject([SampleBusinessNetworkService], (service: SampleBusinessNetworkService) => {
            sinon.restore(businessNetworkMock);

            let name = 'myname';
            let nameversion = 'myname@0.0.1';
            let desc = 'my description';

            let busNetDef = service.createNewBusinessDefinition(nameversion, desc, null, null);
            busNetDef.getName().should.equal(name);
            busNetDef.getDescription().should.equal(desc);
            busNetDef.getVersion().should.equal('0.0.1');
        }));
開發者ID:bloonbullet,項目名稱:composer,代碼行數:12,代碼來源:samplebusinessnetwork.service.spec.ts

示例4: it

        it('should handle errors and revert to uninitialized state', fakeAsync(inject([InitializationService], (service: InitializationService) => {

            mockConfigService.loadConfig.throws();

            mockIdentityCardService.loadIdentityCards.returns(Promise.resolve());

            service.initialize();
            tick();

            mockAlertService.errorStatus$.next.should.have.been.called;
            service['initialized'].should.be.false;

            sinon.restore(mockConfigService.loadConfig);
        })));
開發者ID:bloonbullet,項目名稱:composer,代碼行數:14,代碼來源:initialization.service.spec.ts

示例5: it

        it('should handle errors and revert to uninitialized state', fakeAsync(inject([InitializationService], (service: InitializationService) => {

            let loadConfigStub = sinon.stub(service, 'loadConfig').throws();

            mockAlertService.busyStatus$ = {next: sinon.stub()};
            mockAlertService.errorStatus$ = {next: sinon.stub()};

            service.initialize();
            tick();

            mockAlertService.errorStatus$.next.should.be.called;
            service['initialized'].should.be.false;

            sinon.restore(service.loadConfig);
        })));
開發者ID:GitWhiskey,項目名稱:composer,代碼行數:15,代碼來源:initialization.service.spec.ts

示例6: it

    it('submits a transaction with all cpfp specific parameters', co(function *() {
      const params = {
        cpfpTxIds: ['id'],
        cpfpFeeRate: 1,
        maxFee: 1
      };

      const prebuildReturn = Object.assign({ txHex: '123' }, params);
      const prebuildStub = sinon.stub(wallet, 'prebuildAndSignTransaction').resolves(prebuildReturn);

      const path = `/api/v2/${wallet.coin()}/wallet/${wallet.id()}/tx/send`;
      nock(bgUrl)
      .post(path, _.matches(prebuildReturn))
      .reply(200);

      yield wallet.accelerateTransaction(params);

      prebuildStub.should.have.been.calledOnceWith(params);

      sinon.restore();
    }));
開發者ID:BitGo,項目名稱:BitGoJS,代碼行數:21,代碼來源:wallet.ts

示例7: afterEach

afterEach(() => {
  sinon.restore();
});
開發者ID:elastic,項目名稱:kibana,代碼行數:3,代碼來源:index_migrator.test.ts

示例8: after

		after(function(){
			sinon.restore();
		});
開發者ID:BelaPlatform,項目名稱:Bela,代碼行數:3,代碼來源:IDE.spec.ts

示例9: teardown

 teardown(() => {
   sinon.restore();
 });
開發者ID:Polymer,項目名稱:tools,代碼行數:3,代碼來源:serve_test.ts

示例10: afterEach

			afterEach(function(){
				mock.restore();
				sinon.restore();
			});
開發者ID:BelaPlatform,項目名稱:Bela,代碼行數:4,代碼來源:GitManager.spec.ts


注:本文中的Sinon.restore函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。