本文整理匯總了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();
});