Feature/use expect event in test logs assertions #1232 (#1343)

* Add BigNumber support to expectEvent/inLogs (#1026)

* switched direct logs array check to expectEvent method in AllowanceCrowdsale.test.js

* Refactor expectEvent.inLogs function to use simple value number check

* Introduced should.be.bignumber method to compare BigNumber values

* Use expectEvent to test logs (#1232)

* Removed trailing space

(cherry picked from commit 536262f2ec)
This commit is contained in:
Jakub Bogacz
2018-09-27 16:33:28 +02:00
committed by Leo Arias
parent a9af619c59
commit 39db4b4b05
12 changed files with 135 additions and 134 deletions

View File

@ -32,10 +32,11 @@ function shouldBehaveLikeEscrow (primary, [payee1, payee2]) {
});
it('emits a deposited event', async function () {
const receipt = await this.escrow.deposit(payee1, { from: primary, value: amount });
const event = expectEvent.inLogs(receipt.logs, 'Deposited', { payee: payee1 });
event.args.weiAmount.should.be.bignumber.equal(amount);
const { logs } = await this.escrow.deposit(payee1, { from: primary, value: amount });
expectEvent.inLogs(logs, 'Deposited', {
payee: payee1,
weiAmount: amount
});
});
it('can add multiple deposits on a single account', async function () {
@ -84,10 +85,11 @@ function shouldBehaveLikeEscrow (primary, [payee1, payee2]) {
it('emits a withdrawn event', async function () {
await this.escrow.deposit(payee1, { from: primary, value: amount });
const receipt = await this.escrow.withdraw(payee1, { from: primary });
const event = expectEvent.inLogs(receipt.logs, 'Withdrawn', { payee: payee1 });
event.args.weiAmount.should.be.bignumber.equal(amount);
const { logs } = await this.escrow.withdraw(payee1, { from: primary });
expectEvent.inLogs(logs, 'Withdrawn', {
payee: payee1,
weiAmount: amount
});
});
});
});