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


TypeScript SinonStub.calledBefore方法代碼示例

本文整理匯總了TypeScript中Sinon.SinonStub.calledBefore方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript SinonStub.calledBefore方法的具體用法?TypeScript SinonStub.calledBefore怎麽用?TypeScript SinonStub.calledBefore使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Sinon.SinonStub的用法示例。


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

示例1: it

 it('should call saveBlock and pass tx if genesis does not exist', async () => {
   findByIdStub.resolves(null);
   await inst.saveGenesisBlock();
   expect(txStub.called).is.true;
   expect(saveBlockStub.called).is.true;
   expect(txStub.calledBefore(saveBlockStub)).is.true;
   expect(saveBlockStub.firstCall.args[1]).is.eq('tx');
 });
開發者ID:RiseVision,項目名稱:rise-node,代碼行數:8,代碼來源:chain.spec.ts

示例2: it

 it('should save peers to database with single tx after cleaning peers table', async () => {
   const loggerStub = container.get<LoggerStub>(Symbols.helpers.logger);
   const fakePeers = [createFakePeer(), createFakePeer()];
   peersLogicStub.enqueueResponse('list', fakePeers);
   await inst.cleanup();
   expect(truncateStub.called).is.true;
   expect(bulkCreateStub.called).is.true;
   expect(truncateStub.calledBefore(bulkCreateStub)).is.true;
   expect(bulkCreateStub.firstCall.args[0]).to.be.deep.eq(fakePeers.map((p) => ({...p, broadhash: Buffer.from(p.broadhash, 'hex')})));
   expect(loggerStub.stubs.info.calledOnce).to.be.true;
   expect(loggerStub.stubs.info.firstCall.args.length).to.be.equal(1);
   expect(loggerStub.stubs.info.firstCall.args[0]).to.be.equal('Peers exported to database');
 });
開發者ID:RiseVision,項目名稱:rise-node,代碼行數:13,代碼來源:peers.spec.ts

示例3: it

 it('should call txGenerator and then afterTxPromise', async () => {
   await (instance as any).innerTick(block, 'tx', true, txGeneratorStub, afterTxPromiseStub);
   expect(afterTxPromiseStub.calledOnce).to.be.true;
   expect(txGeneratorStub.calledBefore(afterTxPromiseStub)).is.true;
 });
開發者ID:RiseVision,項目名稱:rise-node,代碼行數:5,代碼來源:rounds.spec.ts


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