aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJared Pereira <jared@otlw.co>2017-03-08 09:49:40 +0800
committerJared Pereira <jared@otlw.co>2017-03-08 09:49:40 +0800
commitde44cd9ba46e562471d64e6cfc56cf8518f45113 (patch)
tree98790d95fcb50f5646718b7e7d9c73e0e1b67542
parent4256e631a6174f04d338412f419ceb0c08d724f1 (diff)
downloadtangerine-wallet-browser-de44cd9ba46e562471d64e6cfc56cf8518f45113.tar
tangerine-wallet-browser-de44cd9ba46e562471d64e6cfc56cf8518f45113.tar.gz
tangerine-wallet-browser-de44cd9ba46e562471d64e6cfc56cf8518f45113.tar.bz2
tangerine-wallet-browser-de44cd9ba46e562471d64e6cfc56cf8518f45113.tar.lz
tangerine-wallet-browser-de44cd9ba46e562471d64e6cfc56cf8518f45113.tar.xz
tangerine-wallet-browser-de44cd9ba46e562471d64e6cfc56cf8518f45113.tar.zst
tangerine-wallet-browser-de44cd9ba46e562471d64e6cfc56cf8518f45113.zip
add gas buffer multiply test
-rw-r--r--test/unit/tx-utils-test.js22
1 files changed, 6 insertions, 16 deletions
diff --git a/test/unit/tx-utils-test.js b/test/unit/tx-utils-test.js
index 6131ed73f..a7f2094c4 100644
--- a/test/unit/tx-utils-test.js
+++ b/test/unit/tx-utils-test.js
@@ -13,26 +13,16 @@ describe('txUtils', function() {
})
describe('addGasBuffer', function() {
- describe('adds a flat value', function() {
- it('over an empty value', function() {
- const input = '0x0'
- const output = txUtils.addGasBuffer(input)
- assert.notEqual(output, input, 'changed the value')
-
- const inputBn = new BN(input, 'hex')
- const outputBn = new BN(output, 'hex')
- assert(outputBn.gt(inputBn), 'returns a greater value')
- })
-
- it('over an value', function() {
+ describe('multiplies by 1.5', function() {
+ it('over a value', function() {
const input = '0x123fad'
- const output = txUtils.addGasBuffer(input)
- assert.notEqual(output, input, 'changed the value')
+ const output = txUtils.addGasBuffer(input, '0x3d4c52') //0x3d4c52 is 4mil for dummy gas limit
const inputBn = new BN(input, 'hex')
const outputBn = new BN(output, 'hex')
- assert(outputBn.gt(inputBn), 'returns a greater value')
+ const expectedBn = inputBn.mul(1.5)
+ assert(outputBn.eq(expectedBn), 'returns 1.5 the input value')
})
})
})
-}) \ No newline at end of file
+})