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

Add test helper to check balance difference #1355

Closed
nventuro opened this issue Sep 26, 2018 · 0 comments · Fixed by #1368
Closed

Add test helper to check balance difference #1355

nventuro opened this issue Sep 26, 2018 · 0 comments · Fixed by #1368
Labels
good first issue Low hanging fruit for new contributors to get involved! tests Test suite and helpers.
Milestone

Comments

@nventuro
Copy link
Contributor

It's been mentioned that we have the following pattern in multiple parts of our test suite:

const preBalance = await ethGetBalance(account);
await this.contract.withdrawPayments(account);
const postBalance = await ethGetBalance(count);

postBalance.sub(preBalance).should.be.bignumber.equal(value);

We should develop a test helper to take care of that (e.g. by receiving a function to await on, and then return the balance difference):

(await balanceDifference(account, () => this.contract.wihtdrawPayments(account)))
  .should.be.bignumber.equal(value);
@nventuro nventuro added good first issue Low hanging fruit for new contributors to get involved! kind:improvement tests Test suite and helpers. labels Sep 26, 2018
@nventuro nventuro added this to the v2.1 milestone Sep 26, 2018
Aniket-Engg added a commit to Aniket-Engg/zeppelin-solidity that referenced this issue Oct 1, 2018
nventuro pushed a commit that referenced this issue Oct 1, 2018
* signing prefix added

* Minor improvement

* Tests changed

* Successfully tested

* Minor improvements

* Minor improvements

* Revert "Dangling commas are now required. (#1359)"

This reverts commit a688977.

* fixex #1355

* linting

* suggested changes

* Update BreakInvariantBounty.test.js
come-maiz pushed a commit that referenced this issue Oct 21, 2018
* signing prefix added

* Minor improvement

* Tests changed

* Successfully tested

* Minor improvements

* Minor improvements

* Revert "Dangling commas are now required. (#1359)"

This reverts commit a688977.

* fixex #1355

* linting

* suggested changes

* Update BreakInvariantBounty.test.js

(cherry picked from commit 6ae041b)
@come-maiz come-maiz modified the milestones: v2.1, v2.0 Oct 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Low hanging fruit for new contributors to get involved! tests Test suite and helpers.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants