aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-11-09 00:39:41 +0800
committerDan Finlay <dan@danfinlay.com>2016-11-09 00:39:41 +0800
commit7068d2e71c6d1ddb68095916dc16f3ff1f283590 (patch)
tree4bbd6d42cddb5c3fafc32dbbb2024d60408473ec /test/unit
parent6f39924e60545ca8ac19995a799c16d0dea11b04 (diff)
downloadtangerine-wallet-browser-7068d2e71c6d1ddb68095916dc16f3ff1f283590.tar
tangerine-wallet-browser-7068d2e71c6d1ddb68095916dc16f3ff1f283590.tar.gz
tangerine-wallet-browser-7068d2e71c6d1ddb68095916dc16f3ff1f283590.tar.bz2
tangerine-wallet-browser-7068d2e71c6d1ddb68095916dc16f3ff1f283590.tar.lz
tangerine-wallet-browser-7068d2e71c6d1ddb68095916dc16f3ff1f283590.tar.xz
tangerine-wallet-browser-7068d2e71c6d1ddb68095916dc16f3ff1f283590.tar.zst
tangerine-wallet-browser-7068d2e71c6d1ddb68095916dc16f3ff1f283590.zip
Adjust gas buffer to be 20% over estimate
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/idStore-test.js9
1 files changed, 4 insertions, 5 deletions
diff --git a/test/unit/idStore-test.js b/test/unit/idStore-test.js
index b0940d2fa..064483ba0 100644
--- a/test/unit/idStore-test.js
+++ b/test/unit/idStore-test.js
@@ -159,7 +159,7 @@ describe('IdentityStore', function() {
assert.equal(result.indexOf('0x'), 0, 'include hex prefix')
})
- it('buffers reasonably', function() {
+ it('buffers 20%', function() {
const idStore = new IdentityStore({
configManager: configManagerGen(),
ethStore: {
@@ -169,18 +169,17 @@ describe('IdentityStore', function() {
const gas = '0x04ee59' // Actual estimated gas example
const bnGas = new BN(ethUtil.stripHexPrefix(gas), 16)
- const correctBuffer = new BN('200000', 10)
+ const five = new BN('5', 10)
+ const correctBuffer = bnGas.div(five)
const correct = bnGas.add(correctBuffer)
- const tooBig = new BN(tooBigOutput, 16)
const result = idStore.addGasBuffer(gas)
const bnResult = new BN(ethUtil.stripHexPrefix(result), 16)
assert.equal(result.indexOf('0x'), 0, 'included hex prefix')
assert(bnResult.gt(bnGas), 'Estimate increased in value.')
- assert.equal(bnResult.sub(bnGas).toString(10), '100000', 'added 100k gas')
+ assert.equal(bnResult.sub(bnGas).toString(10), correctBuffer.toString(10), 'added 20% gas')
assert.equal(result, '0x' + correct.toString(16), 'Added the right amount')
- assert.notEqual(result, tooBigOutput, 'not that bad estimate')
})
})