No longer assigning awaits to temporary variables. (#1216)

This commit is contained in:
Nicolás Venturo
2018-08-17 16:10:40 -03:00
committed by GitHub
parent df9426f989
commit 20cf885430
43 changed files with 231 additions and 467 deletions

View File

@ -17,26 +17,22 @@ contract('PullPayment', function ([_, payer, payee1, payee2]) {
it('can record an async payment correctly', async function () {
await this.contract.callTransfer(payee1, 100, { from: payer });
const paymentsToPayee1 = await this.contract.payments(payee1);
paymentsToPayee1.should.be.bignumber.equal(100);
(await this.contract.payments(payee1)).should.be.bignumber.equal(100);
});
it('can add multiple balances on one account', async function () {
await this.contract.callTransfer(payee1, 200, { from: payer });
await this.contract.callTransfer(payee1, 300, { from: payer });
const paymentsToPayee1 = await this.contract.payments(payee1);
paymentsToPayee1.should.be.bignumber.equal(500);
(await this.contract.payments(payee1)).should.be.bignumber.equal(500);
});
it('can add balances on multiple accounts', async function () {
await this.contract.callTransfer(payee1, 200, { from: payer });
await this.contract.callTransfer(payee2, 300, { from: payer });
const paymentsToPayee1 = await this.contract.payments(payee1);
paymentsToPayee1.should.be.bignumber.equal(200);
(await this.contract.payments(payee1)).should.be.bignumber.equal(200);
const paymentsToPayee2 = await this.contract.payments(payee2);
paymentsToPayee2.should.be.bignumber.equal(300);
(await this.contract.payments(payee2)).should.be.bignumber.equal(300);
});
it('can withdraw payment', async function () {
@ -44,12 +40,10 @@ contract('PullPayment', function ([_, payer, payee1, payee2]) {
await this.contract.callTransfer(payee1, amount, { from: payer });
const payment1 = await this.contract.payments(payee1);
payment1.should.be.bignumber.equal(amount);
(await this.contract.payments(payee1)).should.be.bignumber.equal(amount);
await this.contract.withdrawPayments({ from: payee1 });
const payment2 = await this.contract.payments(payee1);
payment2.should.be.bignumber.equal(0);
(await this.contract.payments(payee1)).should.be.bignumber.equal(0);
const balance = await ethGetBalance(payee1);
Math.abs(balance - initialBalance - amount).should.be.lt(1e16);