From 15b92e409746f7887f7df4bb55d2c3f6ba726b40 Mon Sep 17 00:00:00 2001 From: Hadrien Croubois Date: Tue, 6 Jul 2021 17:20:08 +0200 Subject: [PATCH] Add missing "await" in tests (#2749) * add missing await in tests * fix test description --- .../ERC20/extensions/ERC20FlashMint.test.js | 8 +++---- .../ERC20/extensions/ERC20VotesComp.test.js | 2 +- .../ERC20/extensions/ERC20Wrapper.test.js | 24 +++++++++---------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/test/token/ERC20/extensions/ERC20FlashMint.test.js b/test/token/ERC20/extensions/ERC20FlashMint.test.js index f7465a5ca..97af5bb80 100644 --- a/test/token/ERC20/extensions/ERC20FlashMint.test.js +++ b/test/token/ERC20/extensions/ERC20FlashMint.test.js @@ -45,10 +45,10 @@ contract('ERC20FlashMint', function (accounts) { const receiver = await ERC3156FlashBorrowerMock.new(true, true); const { tx } = await this.token.flashLoan(receiver.address, this.token.address, loanAmount, '0x'); - expectEvent.inTransaction(tx, this.token, 'Transfer', { from: ZERO_ADDRESS, to: receiver.address, value: loanAmount }); - expectEvent.inTransaction(tx, this.token, 'Transfer', { from: receiver.address, to: ZERO_ADDRESS, value: loanAmount }); - expectEvent.inTransaction(tx, receiver, 'BalanceOf', { token: this.token.address, account: receiver.address, value: loanAmount }); - expectEvent.inTransaction(tx, receiver, 'TotalSupply', { token: this.token.address, value: initialSupply.add(loanAmount) }); + await expectEvent.inTransaction(tx, this.token, 'Transfer', { from: ZERO_ADDRESS, to: receiver.address, value: loanAmount }); + await expectEvent.inTransaction(tx, this.token, 'Transfer', { from: receiver.address, to: ZERO_ADDRESS, value: loanAmount }); + await expectEvent.inTransaction(tx, receiver, 'BalanceOf', { token: this.token.address, account: receiver.address, value: loanAmount }); + await expectEvent.inTransaction(tx, receiver, 'TotalSupply', { token: this.token.address, value: initialSupply.add(loanAmount) }); expect(await this.token.totalSupply()).to.be.bignumber.equal(initialSupply); expect(await this.token.balanceOf(receiver.address)).to.be.bignumber.equal('0'); diff --git a/test/token/ERC20/extensions/ERC20VotesComp.test.js b/test/token/ERC20/extensions/ERC20VotesComp.test.js index f3b73cb92..0f0c25ebf 100644 --- a/test/token/ERC20/extensions/ERC20VotesComp.test.js +++ b/test/token/ERC20/extensions/ERC20VotesComp.test.js @@ -52,7 +52,7 @@ async function batchInBlock (txs) { } } -contract('ERC20Votes', function (accounts) { +contract('ERC20VotesComp', function (accounts) { const [ holder, recipient, holderDelegatee, recipientDelegatee, other1, other2 ] = accounts; const name = 'My Token'; diff --git a/test/token/ERC20/extensions/ERC20Wrapper.test.js b/test/token/ERC20/extensions/ERC20Wrapper.test.js index 5b0edc0b7..05652342a 100644 --- a/test/token/ERC20/extensions/ERC20Wrapper.test.js +++ b/test/token/ERC20/extensions/ERC20Wrapper.test.js @@ -44,12 +44,12 @@ contract('ERC20', function (accounts) { it('valid', async function () { await this.underlying.approve(this.token.address, initialSupply, { from: initialHolder }); const { tx } = await this.token.depositFor(initialHolder, initialSupply, { from: initialHolder }); - expectEvent.inTransaction(tx, this.underlying, 'Transfer', { + await expectEvent.inTransaction(tx, this.underlying, 'Transfer', { from: initialHolder, to: this.token.address, value: initialSupply, }); - expectEvent.inTransaction(tx, this.token, 'Transfer', { + await expectEvent.inTransaction(tx, this.token, 'Transfer', { from: ZERO_ADDRESS, to: initialHolder, value: initialSupply, @@ -74,12 +74,12 @@ contract('ERC20', function (accounts) { it('to other account', async function () { await this.underlying.approve(this.token.address, initialSupply, { from: initialHolder }); const { tx } = await this.token.depositFor(anotherAccount, initialSupply, { from: initialHolder }); - expectEvent.inTransaction(tx, this.underlying, 'Transfer', { + await expectEvent.inTransaction(tx, this.underlying, 'Transfer', { from: initialHolder, to: this.token.address, value: initialSupply, }); - expectEvent.inTransaction(tx, this.token, 'Transfer', { + await expectEvent.inTransaction(tx, this.token, 'Transfer', { from: ZERO_ADDRESS, to: anotherAccount, value: initialSupply, @@ -104,12 +104,12 @@ contract('ERC20', function (accounts) { const value = new BN(42); const { tx } = await this.token.withdrawTo(initialHolder, value, { from: initialHolder }); - expectEvent.inTransaction(tx, this.underlying, 'Transfer', { + await expectEvent.inTransaction(tx, this.underlying, 'Transfer', { from: this.token.address, to: initialHolder, value: value, }); - expectEvent.inTransaction(tx, this.token, 'Transfer', { + await expectEvent.inTransaction(tx, this.token, 'Transfer', { from: initialHolder, to: ZERO_ADDRESS, value: value, @@ -118,12 +118,12 @@ contract('ERC20', function (accounts) { it('entire balance', async function () { const { tx } = await this.token.withdrawTo(initialHolder, initialSupply, { from: initialHolder }); - expectEvent.inTransaction(tx, this.underlying, 'Transfer', { + await expectEvent.inTransaction(tx, this.underlying, 'Transfer', { from: this.token.address, to: initialHolder, value: initialSupply, }); - expectEvent.inTransaction(tx, this.token, 'Transfer', { + await expectEvent.inTransaction(tx, this.token, 'Transfer', { from: initialHolder, to: ZERO_ADDRESS, value: initialSupply, @@ -132,12 +132,12 @@ contract('ERC20', function (accounts) { it('to other account', async function () { const { tx } = await this.token.withdrawTo(anotherAccount, initialSupply, { from: initialHolder }); - expectEvent.inTransaction(tx, this.underlying, 'Transfer', { + await expectEvent.inTransaction(tx, this.underlying, 'Transfer', { from: this.token.address, to: anotherAccount, value: initialSupply, }); - expectEvent.inTransaction(tx, this.token, 'Transfer', { + await expectEvent.inTransaction(tx, this.token, 'Transfer', { from: initialHolder, to: ZERO_ADDRESS, value: initialSupply, @@ -151,7 +151,7 @@ contract('ERC20', function (accounts) { await this.token.depositFor(initialHolder, initialSupply, { from: initialHolder }); const { tx } = await this.token.recover(anotherAccount); - expectEvent.inTransaction(tx, this.token, 'Transfer', { + await expectEvent.inTransaction(tx, this.token, 'Transfer', { from: ZERO_ADDRESS, to: anotherAccount, value: '0', @@ -162,7 +162,7 @@ contract('ERC20', function (accounts) { await this.underlying.transfer(this.token.address, initialSupply, { from: initialHolder }); const { tx } = await this.token.recover(anotherAccount); - expectEvent.inTransaction(tx, this.token, 'Transfer', { + await expectEvent.inTransaction(tx, this.token, 'Transfer', { from: ZERO_ADDRESS, to: anotherAccount, value: initialSupply,