Skip to content
Snippets Groups Projects
Commit e4c739b6 authored by Cédric Moreau's avatar Cédric Moreau
Browse files

[enh] Refactoring: `TestUser.send` replaced by `TestUser.sendMoney`

parent a091ae1a
No related branches found
No related tags found
No related merge requests found
......@@ -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 });
})
......
......@@ -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(() => {
......
......@@ -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()
})
})
}
}
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment