No longer assigning awaits to temporary variables. (#1216)
This commit is contained in:
@ -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);
|
||||
|
||||
Reference in New Issue
Block a user