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

Commit

Permalink
test gas estimate for account to account transfer (#204)
Browse files Browse the repository at this point in the history
Add regression test for gas estimate for simple value transfer between accounts. There was previously a same-day hot fix on a release for this issue, but there was no time for the test at that moment... so here is the test!
  • Loading branch information
eshaben authored and davidmurdoch committed Nov 2, 2018
1 parent b7c312a commit 9b28b38
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 7 deletions.
29 changes: 22 additions & 7 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions test/gas.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,21 @@ describe("Gas", function() {

return to.hex(Buffer.from(bytes));
}

it("matches usage for simple account to account transfer", async function() {
let transferAmount = web3.utils.toBN(web3.utils.toWei("5", "finney"));
let transactionData = {
from: accounts[0],
to: accounts[1],
value: transferAmount
};

let gasEstimate = await web3.eth.estimateGas(transactionData);

let receipt = await web3.eth.sendTransaction(transactionData);

assert.strictEqual(receipt.gasUsed, gasEstimate);
});
});

describe("Expenditure", function() {
Expand Down

0 comments on commit 9b28b38

Please sign in to comment.