From b03932529ce4ba1ef2caf4520700d452da99853b Mon Sep 17 00:00:00 2001 From: Aniket <30843294+Aniket-Engg@users.noreply.github.com> Date: Mon, 1 Oct 2018 20:53:47 +0530 Subject: [PATCH] Fix/#1355 test helper to check balance difference (#1368) * signing prefix added * Minor improvement * Tests changed * Successfully tested * Minor improvements * Minor improvements * Revert "Dangling commas are now required. (#1359)" This reverts commit a6889776f46adca374b6ebf014aa7b0038112a9d. * fixex #1355 * linting * suggested changes * Update BreakInvariantBounty.test.js (cherry picked from commit 6ae041bca61ff2d6c25acc865b0152cf54122528) --- test/helpers/balanceDiff.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 test/helpers/balanceDiff.js diff --git a/test/helpers/balanceDiff.js b/test/helpers/balanceDiff.js new file mode 100644 index 000000000..8f88ba400 --- /dev/null +++ b/test/helpers/balanceDiff.js @@ -0,0 +1,10 @@ +async function balanceDifference (account, promise) { + const balanceBefore = web3.eth.getBalance(account); + await promise(); + const balanceAfter = web3.eth.getBalance(account); + return balanceAfter.minus(balanceBefore); +} + +module.exports = { + balanceDifference, +};