Skip to content
This repository has been archived by the owner on Jan 4, 2024. It is now read-only.

Commit

Permalink
Update dependencies & bump version to 0.9.2
Browse files Browse the repository at this point in the history
  • Loading branch information
rkalis committed Oct 21, 2019
1 parent cf9c1ad commit 2c97caa
Show file tree
Hide file tree
Showing 4 changed files with 411 additions and 302 deletions.
12 changes: 6 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const assertEventEmittedFromTxResult = (result, eventType, filter, message) => {
validateResult(result);

/* Filter correct event types */
const events = result.logs.filter(entry => entry.event === eventType);
const events = result.logs.filter((entry) => entry.event === eventType);

// TODO: Move the getPrettyEmittedEventsString to the assertion functions
assertEventListNotEmpty(events, message, `Event of type ${eventType} was not emitted\n${getPrettyEmittedEventsString(result)}`);
Expand All @@ -82,7 +82,7 @@ const assertEventEmittedFromTxResult = (result, eventType, filter, message) => {
}

/* Filter correct arguments */
let eventArgs = events.map(entry => entry.args);
let eventArgs = events.map((entry) => entry.args);

eventArgs = eventArgs.filter(filter);
assertEventListNotEmpty(eventArgs, message, `Event filter for ${eventType} returned no results\n${getPrettyEmittedEventsString(result)}`);
Expand All @@ -92,7 +92,7 @@ const assertEventNotEmittedFromTxResult = (result, eventType, filter, message) =
validateResult(result);

/* Filter correct event types */
const events = result.logs.filter(entry => entry.event === eventType);
const events = result.logs.filter((entry) => entry.event === eventType);

/* Only check filtered events if there is no provided filter function */
if (filter === undefined || filter === null) {
Expand All @@ -101,7 +101,7 @@ const assertEventNotEmittedFromTxResult = (result, eventType, filter, message) =
}

/* Filter correct arguments */
let eventArgs = events.map(entry => entry.args);
let eventArgs = events.map((entry) => entry.args);
eventArgs = eventArgs.filter(filter);
assertEventListEmpty(eventArgs, message, `Event filter for ${eventType} returned results\n${getPrettyEmittedEventsString(result)}`);
};
Expand All @@ -116,7 +116,7 @@ const createTransactionResult = async (contract, transactionHash) => {
return {
tx: transactionHash,
receipt: transactionReceipt,
logs: eventList.filter(ev => ev.transactionHash === transactionHash),
logs: eventList.filter((ev) => ev.transactionHash === transactionHash),
};
}

Expand All @@ -128,7 +128,7 @@ const createTransactionResult = async (contract, transactionHash) => {
resolve({
tx: transactionHash,
receipt: transactionReceipt,
logs: events.filter(ev => ev.transactionHash === transactionHash),
logs: events.filter((ev) => ev.transactionHash === transactionHash),
});
});
});
Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "truffle-assertions",
"version": "0.9.1",
"version": "0.9.2",
"description": "Additional assertions and utilities for testing Ethereum smart contracts in Truffle unit tests",
"main": "index.js",
"files": [
Expand Down Expand Up @@ -41,13 +41,13 @@
"devDependencies": {
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"codecov": "^3.1.0",
"coveralls": "^3.0.2",
"eslint": "^5.6.1",
"eslint-config-airbnb-base": "^13.1.0",
"eslint-plugin-import": "^2.14.0",
"mocha": "^5.2.0",
"nyc": "^13.3.0",
"sinon": "^7.1.1"
"codecov": "^3.6.1",
"coveralls": "^3.0.7",
"eslint": "^6.5.1",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-plugin-import": "^2.18.2",
"mocha": "^6.2.2",
"nyc": "^14.1.1",
"sinon": "^7.5.0"
}
}
14 changes: 7 additions & 7 deletions test/events.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('eventEmitted', () => {

it('should fail when event is emitted with incorrect arguments given as function', () => {
assert.throws(() => (
truffleAssert.eventEmitted(truffleV4loseResult, 'Play', ev => ev.betNumber === ev.winningNumber)
truffleAssert.eventEmitted(truffleV4loseResult, 'Play', (ev) => ev.betNumber === ev.winningNumber)
), AssertionError);
});

Expand All @@ -28,7 +28,7 @@ describe('eventEmitted', () => {

it('should return passed error message when event is emitted with incorrect arguments', () => {
assert.throws(() => (
truffleAssert.eventEmitted(truffleV4loseResult, 'Play', ev => ev.betNumber === ev.winningNumber, 'Should win')
truffleAssert.eventEmitted(truffleV4loseResult, 'Play', (ev) => ev.betNumber === ev.winningNumber, 'Should win')
), /Should win/);
});

Expand All @@ -37,7 +37,7 @@ describe('eventEmitted', () => {
});

it('should pass when event is emitted with correct arguments given as function', () => {
truffleAssert.eventEmitted(truffleV4winResult, 'Play', ev => ev.betNumber === ev.winningNumber);
truffleAssert.eventEmitted(truffleV4winResult, 'Play', (ev) => ev.betNumber === ev.winningNumber);
});

it('should pass when event is emitted with correct arguments given as an object', () => {
Expand Down Expand Up @@ -65,7 +65,7 @@ describe('eventEmitted', () => {

it('should throw an error when contract instance is passed instead of tx result', () => {
assert.throws(() => (
truffleAssert.eventEmitted({}, 'Play', ev => ev.betNumber === ev.winningNumber)
truffleAssert.eventEmitted({}, 'Play', (ev) => ev.betNumber === ev.winningNumber)
), truffleAssert.InvalidTxResultError);
});
});
Expand All @@ -81,13 +81,13 @@ describe('eventNotEmitted', () => {

it('should fail when event with specified arguments is emitted', () => {
assert.throws(() => (
truffleAssert.eventNotEmitted(truffleV4winResult, 'Play', ev => ev.betNumber === ev.winningNumber)
truffleAssert.eventNotEmitted(truffleV4winResult, 'Play', (ev) => ev.betNumber === ev.winningNumber)
), AssertionError);
});

it('should return passed error message when event with specified arguments is emitted', () => {
assert.throws(() => (
truffleAssert.eventNotEmitted(truffleV4winResult, 'Play', ev => ev.betNumber === ev.winningNumber, 'Should not win')
truffleAssert.eventNotEmitted(truffleV4winResult, 'Play', (ev) => ev.betNumber === ev.winningNumber, 'Should not win')
), /Should not win/);
});

Expand All @@ -96,7 +96,7 @@ describe('eventNotEmitted', () => {
});

it('should pass when event with specified arguments given as function is not emitted', () => {
truffleAssert.eventNotEmitted(truffleV4winResult, 'Play', ev => ev.betNumber !== ev.winningNumber);
truffleAssert.eventNotEmitted(truffleV4winResult, 'Play', (ev) => ev.betNumber !== ev.winningNumber);
});

it('should pass when event with specified arguments given as object is not emitted', () => {
Expand Down
Loading

0 comments on commit 2c97caa

Please sign in to comment.