aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/idStore-test.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/idStore-test.js')
-rw-r--r--test/unit/idStore-test.js14
1 files changed, 6 insertions, 8 deletions
diff --git a/test/unit/idStore-test.js b/test/unit/idStore-test.js
index 34b0c992e..46b3d4809 100644
--- a/test/unit/idStore-test.js
+++ b/test/unit/idStore-test.js
@@ -169,20 +169,18 @@ describe('IdentityStore', function() {
const gas = '0x04ee59' // Actual estimated gas example
const tooBigOutput = '0x80674f9' // Actual bad output
- const bnGas = new BN(gas, 16)
+ const bnGas = new BN(ethUtil.stripHexPrefix(gas), 16)
const correctBuffer = new BN('100000', 10)
const correct = bnGas.add(correctBuffer)
const tooBig = new BN(tooBigOutput, 16)
- console.log(`Pure estimate is ${bnGas.toString(10)}`)
- console.log(`Too big is ${tooBig.toString(10)}`)
- console.log(`Buffer should be ${correctBuffer.toString(10)}`)
- console.log(`correct should be ${correct.toString(10)}`)
const result = idStore.addGasBuffer(gas)
- const bnResult = new BN(result, 16)
+ const bnResult = new BN(ethUtil.stripHexPrefix(result), 16)
- console.log(`Result was ${bnResult.toString(10)}`)
- assert.equal(result, correct.toString(16), 'add the right amount')
+ 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(result, '0x' + correct.toString(16), 'Added the right amount')
assert.notEqual(result, tooBigOutput, 'not that bad estimate')
})
})