* 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:
@ -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
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user