本文整理汇总了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();
});
示例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();
}));
示例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');
}));
示例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);
})));
示例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);
})));
示例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();
}));
示例7: afterEach
afterEach(() => {
sinon.restore();
});
示例8: after
after(function(){
sinon.restore();
});
示例9: teardown
teardown(() => {
sinon.restore();
});
示例10: afterEach
afterEach(function(){
mock.restore();
sinon.restore();
});