From e4c739b671ab7effc3269257b46e16ee4fec1629 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Moreau?= <cem.moreau@gmail.com> Date: Tue, 8 May 2018 22:31:10 +0200 Subject: [PATCH] [enh] Refactoring: `TestUser.send` replaced by `TestUser.sendMoney` --- test/integration/branches/branches_revert2.ts | 4 ++-- .../integration/protocol/v0.5-transactions.ts | 2 +- test/integration/tools/TestUser.ts | 22 ------------------- .../transactions/transactions-test.ts | 2 +- 4 files changed, 4 insertions(+), 26 deletions(-) diff --git a/test/integration/branches/branches_revert2.ts b/test/integration/branches/branches_revert2.ts index 67dc35b6f..34d59d316 100644 --- a/test/integration/branches/branches_revert2.ts +++ b/test/integration/branches/branches_revert2.ts @@ -70,7 +70,7 @@ describe("Revert two blocks", function() { await s1.commit({ time: now }); await s1.commit({ time: now + 1 }); await s1.commit({ time: now + 1 }); - await cat.sendP(51, toc); + await cat.sendMoney(51, toc); await s1.commit({ time: now + 1 }); }); @@ -189,7 +189,7 @@ describe("Revert two blocks", function() { before(async () => { await s1.dal.txsDAL.removeAll() - await cat.sendP(19, toc); + await cat.sendMoney(19, toc); await s1.dal.blockDAL.removeBlock('DELETE FROM block WHERE fork AND number = 3') await s1.commit({ time: now + 1 }); }) diff --git a/test/integration/protocol/v0.5-transactions.ts b/test/integration/protocol/v0.5-transactions.ts index 836eaffb0..63863a77f 100644 --- a/test/integration/protocol/v0.5-transactions.ts +++ b/test/integration/protocol/v0.5-transactions.ts @@ -38,7 +38,7 @@ describe("Protocol 0.5 Transaction version", function() { await s1.commit({ time: now }); await s1.commit({ time: now + 100 }); await s1.commit({ time: now + 100 }); - await cat.sendP(51, tac); + await cat.sendMoney(51, tac); }) after(() => { diff --git a/test/integration/tools/TestUser.ts b/test/integration/tools/TestUser.ts index c4f8c6b35..ddd6e515a 100644 --- a/test/integration/tools/TestUser.ts +++ b/test/integration/tools/TestUser.ts @@ -184,19 +184,6 @@ export class TestUser { }) } - public send(amount:number, recipient:TestUser|string, comment?:string) { - const that = this - return async function(done:(e?:any)=>void) { - try { - let raw = await that.prepareITX(amount, recipient, comment) - await that.sendTX(raw) - done() - } catch (e) { - done(e) - } - }; - }; - public async sendMoney(amount:number, recipient:TestUser, comment?:string) { const raw = await this.prepareITX(amount, recipient, comment) await this.sendTX(raw) @@ -405,13 +392,4 @@ export class TestUser { const node2 = await this.getContacter(fromServer) return node2.getLookup(pubkey); } - - public async sendP(amount:number, userid:TestUser|string, comment?:string) { - return new Promise((res, rej) => { - this.send(amount, userid, comment)((err:any) => { - if (err) return rej(err) - res() - }) - }) - } } diff --git a/test/integration/transactions/transactions-test.ts b/test/integration/transactions/transactions-test.ts index fe470cffa..3b04c54ea 100644 --- a/test/integration/transactions/transactions-test.ts +++ b/test/integration/transactions/transactions-test.ts @@ -60,7 +60,7 @@ describe("Testing transactions", function() { await s1.commit({ time: now + 7210 }); - await tic.sendP(510, toc); + await tic.sendMoney(510, toc); await s1.expect('/tx/history/DKpQPUL4ckzXYdnDRvCRKAm1gNvSdmAXnTrJZ7LvM5Qo', (res:any) => { res.should.have.property('pubkey').equal('DKpQPUL4ckzXYdnDRvCRKAm1gNvSdmAXnTrJZ7LvM5Qo'); res.should.have.property('history').property('pending').length(1); -- GitLab