aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/idStore-test.js
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-11-18 05:51:32 +0800
committerDan Finlay <dan@danfinlay.com>2016-11-18 05:51:32 +0800
commit4352c7031afb6f9a175b29d0addeb7ea48345676 (patch)
treeecb311d43d0f77d5f5f0e82a0014a09c6381f0ef /test/unit/idStore-test.js
parentf229d32442f34859be169e38a42ffecdfb8fc48a (diff)
parent592b64a19fd7001d965aa1a1c329b24f55d2ea90 (diff)
downloadtangerine-wallet-browser-4352c7031afb6f9a175b29d0addeb7ea48345676.tar.gz
tangerine-wallet-browser-4352c7031afb6f9a175b29d0addeb7ea48345676.tar.zst
tangerine-wallet-browser-4352c7031afb6f9a175b29d0addeb7ea48345676.zip
Merge branch 'i328-MultiVault' of github.com:MetaMask/metamask-plugin into i328-MultiVault
Diffstat (limited to 'test/unit/idStore-test.js')
-rw-r--r--test/unit/idStore-test.js10
1 files changed, 4 insertions, 6 deletions
diff --git a/test/unit/idStore-test.js b/test/unit/idStore-test.js
index 46b3d4809..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: {
@@ -168,20 +168,18 @@ describe('IdentityStore', function() {
})
const gas = '0x04ee59' // Actual estimated gas example
- const tooBigOutput = '0x80674f9' // Actual bad output
const bnGas = new BN(ethUtil.stripHexPrefix(gas), 16)
- const correctBuffer = new BN('100000', 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')
})
})