* Changed .eq to .equal * Changed equal(bool) to .to.be.bool * Changed be.bool to equal(bool), disallowed unused expressions.
22 lines
504 B
JavaScript
22 lines
504 B
JavaScript
const should = require('chai').should();
|
|
|
|
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.equal(v);
|
|
}
|
|
return event;
|
|
}
|
|
|
|
async function inTransaction (tx, eventName, eventArgs = {}) {
|
|
const { logs } = await tx;
|
|
return inLogs(logs, eventName, eventArgs);
|
|
}
|
|
|
|
module.exports = {
|
|
inLogs,
|
|
inTransaction,
|
|
};
|