Commit 31fc572a by Nicolás Venturo Committed by Matt Condon

inLogs no longer returns a promise. (#1169)

parent 4066b5e6
......@@ -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);
......
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)) {
......
......@@ -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);
});
});
......
......@@ -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 () {
......
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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment