Now testing events in constructors! (#1511)
* Added inTransaction tests.
* Added expectEvent.inConstructor.
* Changed inTransaction, removed decodeLogs.
* Flipped comparison to improve the error message.
* Improved expectEvent tests.
* Migrated tests to use expectEvent.
* Added roles constructor tests.
* Fixed linter errors.
* Made lodash a dev dependency.
* Added more inLogs tests.
* Update expectEvent.test.js
* Removed lodash.
* Moved role constructor tests to public role behavior.
* Revert "Flipped comparison to improve the error message."
This reverts commit 438c57833d.
* Replaced chai-as-promised with shouldFail.
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
const { decodeLogs } = require('../helpers/decodeLogs');
|
||||
const expectEvent = require('../helpers/expectEvent');
|
||||
const { ZERO_ADDRESS } = require('../helpers/constants');
|
||||
const SimpleToken = artifacts.require('SimpleToken');
|
||||
|
||||
@ -31,12 +31,10 @@ contract('SimpleToken', function ([_, creator]) {
|
||||
|
||||
creatorBalance.should.be.bignumber.equal(totalSupply);
|
||||
|
||||
const receipt = await web3.eth.getTransactionReceipt(this.token.transactionHash);
|
||||
const logs = decodeLogs(receipt.logs, SimpleToken, this.token.address);
|
||||
logs.length.should.equal(1);
|
||||
logs[0].event.should.equal('Transfer');
|
||||
logs[0].args.from.valueOf().should.equal(ZERO_ADDRESS);
|
||||
logs[0].args.to.valueOf().should.equal(creator);
|
||||
logs[0].args.value.should.be.bignumber.equal(totalSupply);
|
||||
await expectEvent.inConstruction(this.token, 'Transfer', {
|
||||
from: ZERO_ADDRESS,
|
||||
to: creator,
|
||||
value: totalSupply,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user