Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Now testing events in constructors! #1511

Merged
merged 16 commits into from
Nov 27, 2018

Conversation

nventuro
Copy link
Contributor

@nventuro nventuro commented Nov 22, 2018

I tried to contain the changes in separate commits so that they can more easily be reviewed in order.

In the process, I got rid of decodeLogs, since it is too low level, and was only used once (in a quite awful way). That meant improving and changing what inTransaction does: it receives a transaction hash and a contract object, and looks for events emitted by a contract of that type in that transaction. This is necessary when events were not emitted by the called contract but by an indirectly called one, since truffle won't decode those (see the new inLogs tests).

A bit more work is missing to support multiple events of the same type being emitted in a single transaction (what PaymentSplitter does at construction), but that should be easy to include after this is merged.

Fixes #1354

@nventuro nventuro added feature New contracts, functions, or helpers. tests Test suite and helpers. labels Nov 22, 2018
@nventuro nventuro added this to the Test helpers milestone Nov 22, 2018
@nventuro nventuro requested a review from frangio November 22, 2018 20:10
package.json Outdated Show resolved Hide resolved
test/helpers/expectEvent.js Outdated Show resolved Hide resolved
test/access/roles/PauserRole.test.js Outdated Show resolved Hide resolved
test/helpers/test/expectEvent.test.js Outdated Show resolved Hide resolved
test/helpers/expectEvent.js Show resolved Hide resolved
test/helpers/expectEvent.js Outdated Show resolved Hide resolved
@nventuro
Copy link
Contributor Author

@frangio PTAL!

Copy link
Contributor

@frangio frangio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

package-lock.json Outdated Show resolved Hide resolved
@nventuro nventuro merged commit c2de8ff into OpenZeppelin:master Nov 27, 2018
@nventuro nventuro deleted the constr-events branch November 27, 2018 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New contracts, functions, or helpers. tests Test suite and helpers.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants