inLogs no longer returns a promise. (#1169)

This commit is contained in:
Nicolás Venturo
2018-08-08 14:57:00 -03:00
committed by Matt Condon
parent 4066b5e683
commit 31fc572abe
5 changed files with 12 additions and 12 deletions

View File

@ -33,7 +33,7 @@ contract('Bounty', function ([_, owner, researcher]) {
context('with reward', function () { context('with reward', function () {
beforeEach(async function () { beforeEach(async function () {
const result = await this.bounty.createTarget({ from: researcher }); 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; this.targetAddress = event.args.createdAddress;
@ -56,7 +56,7 @@ contract('Bounty', function ([_, owner, researcher]) {
this.bounty = await InsecureTargetBounty.new(); this.bounty = await InsecureTargetBounty.new();
const result = await this.bounty.createTarget({ from: researcher }); 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; this.targetAddress = event.args.createdAddress;
await sendReward(owner, this.bounty.address, reward); await sendReward(owner, this.bounty.address, reward);

View File

@ -1,6 +1,6 @@
const should = require('chai').should(); const should = require('chai').should();
async function inLogs (logs, eventName, eventArgs = {}) { function inLogs (logs, eventName, eventArgs = {}) {
const event = logs.find(e => e.event === eventName); const event = logs.find(e => e.event === eventName);
should.exist(event); should.exist(event);
for (const [k, v] of Object.entries(eventArgs)) { for (const [k, v] of Object.entries(eventArgs)) {

View File

@ -35,7 +35,7 @@ function shouldBehaveLikeEscrow (owner, [payee1, payee2]) {
it('emits a deposited event', async function () { it('emits a deposited event', async function () {
const receipt = await this.escrow.deposit(payee1, { from: owner, value: amount }); 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); 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 }); await this.escrow.deposit(payee1, { from: owner, value: amount });
const receipt = await this.escrow.withdraw(payee1, { from: owner }); 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); event.args.weiAmount.should.be.bignumber.equal(amount);
}); });
}); });

View File

@ -43,7 +43,7 @@ contract('RefundEscrow', function ([_, owner, beneficiary, refundee1, refundee2]
const receipt = await this.escrow.close({ from: owner }); const receipt = await this.escrow.close({ from: owner });
await expectEvent.inLogs(receipt.logs, 'Closed'); expectEvent.inLogs(receipt.logs, 'Closed');
}); });
context('closed state', function () { context('closed state', function () {
@ -75,7 +75,7 @@ contract('RefundEscrow', function ([_, owner, beneficiary, refundee1, refundee2]
const receipt = await this.escrow.enableRefunds({ from: owner }); const receipt = await this.escrow.enableRefunds({ from: owner });
await expectEvent.inLogs(receipt.logs, 'RefundsEnabled'); expectEvent.inLogs(receipt.logs, 'RefundsEnabled');
}); });
context('refund state', function () { context('refund state', function () {

View File

@ -1,5 +1,5 @@
const { assertRevert } = require('../../helpers/assertRevert'); const { assertRevert } = require('../../helpers/assertRevert');
const { inLogs } = require('../../helpers/expectEvent'); const expectEvent = require('../../helpers/expectEvent');
const BigNumber = web3.BigNumber; const BigNumber = web3.BigNumber;
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'; const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
@ -23,13 +23,13 @@ function shouldBehaveLikeBurnableToken (owner, initialBalance, [burner]) {
}); });
it('emits a burn event', async function () { 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.burner.should.eq(owner);
event.args.value.should.be.bignumber.equal(amount); event.args.value.should.be.bignumber.equal(amount);
}); });
it('emits a transfer event', async function () { 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.from.should.eq(owner);
event.args.to.should.eq(ZERO_ADDRESS); event.args.to.should.eq(ZERO_ADDRESS);
event.args.value.should.be.bignumber.equal(amount); event.args.value.should.be.bignumber.equal(amount);
@ -66,13 +66,13 @@ function shouldBehaveLikeBurnableToken (owner, initialBalance, [burner]) {
}); });
it('emits a burn event', async function () { 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.burner.should.eq(owner);
event.args.value.should.be.bignumber.equal(amount); event.args.value.should.be.bignumber.equal(amount);
}); });
it('emits a transfer event', async function () { 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.from.should.eq(owner);
event.args.to.should.eq(ZERO_ADDRESS); event.args.to.should.eq(ZERO_ADDRESS);
event.args.value.should.be.bignumber.equal(amount); event.args.value.should.be.bignumber.equal(amount);