• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript Sinon.restore函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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 = '[email protected]';
            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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript Sinon.spy函数代码示例发布时间:2022-05-25
下一篇:
TypeScript Sinon.mock函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap