Files
openzeppelin-contracts/test/helpers/expectEvent.js
Nicolás Venturo cea2a85a42 Remove Babel (#1074)
* Test helpers no longer rely on Babel.

* Behaviours are no longer imported.

* Removed Babel dependency.

* Fixed linter errors.
2018-07-18 19:37:16 -03:00

22 lines
507 B
JavaScript

const should = require('chai').should();
async function inLogs (logs, eventName, eventArgs = {}) {
const event = logs.find(e => e.event === eventName);
should.exist(event);
for (const [k, v] of Object.entries(eventArgs)) {
should.exist(event.args[k]);
event.args[k].should.eq(v);
}
return event;
}
async function inTransaction (tx, eventName, eventArgs = {}) {
const { logs } = await tx;
return inLogs(logs, eventName, eventArgs);
}
module.exports = {
inLogs,
inTransaction,
};