From 31fc572abe36700122ab05ae801940122ad6182b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Venturo?= Date: Wed, 8 Aug 2018 14:57:00 -0300 Subject: [PATCH] inLogs no longer returns a promise. (#1169) --- test/Bounty.test.js | 4 ++-- test/helpers/expectEvent.js | 2 +- test/payment/Escrow.behavior.js | 4 ++-- test/payment/RefundEscrow.test.js | 4 ++-- test/token/ERC20/BurnableToken.behavior.js | 10 +++++----- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/test/Bounty.test.js b/test/Bounty.test.js index 8417e17d1..a3bf7a989 100644 --- a/test/Bounty.test.js +++ b/test/Bounty.test.js @@ -33,7 +33,7 @@ contract('Bounty', function ([_, owner, researcher]) { context('with reward', function () { beforeEach(async function () { const result = await this.bounty.createTarget({ from: researcher }); - const event = await expectEvent.inLogs(result.logs, 'TargetCreated'); + const event = expectEvent.inLogs(result.logs, 'TargetCreated'); this.targetAddress = event.args.createdAddress; @@ -56,7 +56,7 @@ contract('Bounty', function ([_, owner, researcher]) { this.bounty = await InsecureTargetBounty.new(); const result = await this.bounty.createTarget({ from: researcher }); - const event = await expectEvent.inLogs(result.logs, 'TargetCreated'); + const event = expectEvent.inLogs(result.logs, 'TargetCreated'); this.targetAddress = event.args.createdAddress; await sendReward(owner, this.bounty.address, reward); diff --git a/test/helpers/expectEvent.js b/test/helpers/expectEvent.js index 168434401..1bfacd6f2 100644 --- a/test/helpers/expectEvent.js +++ b/test/helpers/expectEvent.js @@ -1,6 +1,6 @@ const should = require('chai').should(); -async function inLogs (logs, eventName, eventArgs = {}) { +function inLogs (logs, eventName, eventArgs = {}) { const event = logs.find(e => e.event === eventName); should.exist(event); for (const [k, v] of Object.entries(eventArgs)) { diff --git a/test/payment/Escrow.behavior.js b/test/payment/Escrow.behavior.js index 18c570566..760f4c4c7 100644 --- a/test/payment/Escrow.behavior.js +++ b/test/payment/Escrow.behavior.js @@ -35,7 +35,7 @@ function shouldBehaveLikeEscrow (owner, [payee1, payee2]) { it('emits a deposited event', async function () { const receipt = await this.escrow.deposit(payee1, { from: owner, value: amount }); - const event = await expectEvent.inLogs(receipt.logs, 'Deposited', { payee: payee1 }); + const event = expectEvent.inLogs(receipt.logs, 'Deposited', { payee: payee1 }); event.args.weiAmount.should.be.bignumber.equal(amount); }); @@ -92,7 +92,7 @@ function shouldBehaveLikeEscrow (owner, [payee1, payee2]) { await this.escrow.deposit(payee1, { from: owner, value: amount }); const receipt = await this.escrow.withdraw(payee1, { from: owner }); - const event = await expectEvent.inLogs(receipt.logs, 'Withdrawn', { payee: payee1 }); + const event = expectEvent.inLogs(receipt.logs, 'Withdrawn', { payee: payee1 }); event.args.weiAmount.should.be.bignumber.equal(amount); }); }); diff --git a/test/payment/RefundEscrow.test.js b/test/payment/RefundEscrow.test.js index 278ecccd8..8eb43593c 100644 --- a/test/payment/RefundEscrow.test.js +++ b/test/payment/RefundEscrow.test.js @@ -43,7 +43,7 @@ contract('RefundEscrow', function ([_, owner, beneficiary, refundee1, refundee2] const receipt = await this.escrow.close({ from: owner }); - await expectEvent.inLogs(receipt.logs, 'Closed'); + expectEvent.inLogs(receipt.logs, 'Closed'); }); context('closed state', function () { @@ -75,7 +75,7 @@ contract('RefundEscrow', function ([_, owner, beneficiary, refundee1, refundee2] const receipt = await this.escrow.enableRefunds({ from: owner }); - await expectEvent.inLogs(receipt.logs, 'RefundsEnabled'); + expectEvent.inLogs(receipt.logs, 'RefundsEnabled'); }); context('refund state', function () { diff --git a/test/token/ERC20/BurnableToken.behavior.js b/test/token/ERC20/BurnableToken.behavior.js index 0bf3aa2ad..cd66195d3 100644 --- a/test/token/ERC20/BurnableToken.behavior.js +++ b/test/token/ERC20/BurnableToken.behavior.js @@ -1,5 +1,5 @@ const { assertRevert } = require('../../helpers/assertRevert'); -const { inLogs } = require('../../helpers/expectEvent'); +const expectEvent = require('../../helpers/expectEvent'); const BigNumber = web3.BigNumber; const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'; @@ -23,13 +23,13 @@ function shouldBehaveLikeBurnableToken (owner, initialBalance, [burner]) { }); it('emits a burn event', async function () { - const event = await inLogs(this.logs, 'Burn'); + const event = expectEvent.inLogs(this.logs, 'Burn'); event.args.burner.should.eq(owner); event.args.value.should.be.bignumber.equal(amount); }); it('emits a transfer event', async function () { - const event = await inLogs(this.logs, 'Transfer'); + const event = expectEvent.inLogs(this.logs, 'Transfer'); event.args.from.should.eq(owner); event.args.to.should.eq(ZERO_ADDRESS); event.args.value.should.be.bignumber.equal(amount); @@ -66,13 +66,13 @@ function shouldBehaveLikeBurnableToken (owner, initialBalance, [burner]) { }); it('emits a burn event', async function () { - const event = await inLogs(this.logs, 'Burn'); + const event = expectEvent.inLogs(this.logs, 'Burn'); event.args.burner.should.eq(owner); event.args.value.should.be.bignumber.equal(amount); }); it('emits a transfer event', async function () { - const event = await inLogs(this.logs, 'Transfer'); + const event = expectEvent.inLogs(this.logs, 'Transfer'); event.args.from.should.eq(owner); event.args.to.should.eq(ZERO_ADDRESS); event.args.value.should.be.bignumber.equal(amount);