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

Tests: Refactors and enhancements #525

Merged
merged 2 commits into from May 9, 2019

Conversation

Projects
None yet
3 participants
@facuspagnuolo
Copy link
Contributor

commented May 8, 2019

This PR carries some test suite enhancements:

  • Use new assertRevert syntax
  • Provide better way to assert events
  • Remove unused variables
  • Improve imports

@facuspagnuolo facuspagnuolo self-assigned this May 8, 2019

@coveralls

This comment has been minimized.

Copy link

commented May 8, 2019

Coverage Status

Coverage remained the same at 99.542% when pulling 8917944 on refactor_tests_events_assertions into 220b6b1 on dev.

@sohkai

sohkai approved these changes May 9, 2019

Copy link
Member

left a comment

❤️ Great improvement @facuspagnuolo 🙏

No doubt you've noticed the indentation switches between 4 and 2-space tabs (depending on how much recent work was done on a particular test file), but we'll be able to fix this automatically with prettier once we have the shared config up :).

const getEvents = ({ logs = [] }, event) => logs.filter(l => l.event === event)
const getEventAt = (receipt, event, index = 0) => getEvents(receipt, event)[index]
const getEventArgument = (receipt, event, arg, index = 0) => getEventAt(receipt, event, index).args[arg]
const getNewProxyAddress = (receipt) => getEventArgument(receipt, 'NewAppProxy', 'proxy')

This comment has been minimized.

Copy link
@sohkai

sohkai May 9, 2019

Member

What do you think about moving these getters to a separate file, perhaps events.js? There's a few now, so it might be nice to separate the utilities from the custom assertions.

@facuspagnuolo facuspagnuolo merged commit d10d195 into dev May 9, 2019

5 checks passed

License Compliance All checks passed.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
coverage/coveralls Coverage remained the same at 99.542%
Details
license/cla Contributor License Agreement is signed.
Details

@facuspagnuolo facuspagnuolo deleted the refactor_tests_events_assertions branch May 9, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.