diff options
author | Kevin Serrano <kevgagser@gmail.com> | 2017-03-09 01:28:36 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-09 01:28:36 +0800 |
commit | 86f71d504cc3acd758958f883520fe913903a2c2 (patch) | |
tree | 7d6bcabbde524f5bad1d6f45802af77a12778c07 /test | |
parent | 0ee8ca178e9240ab25454bafc88c58ebef6b69c3 (diff) | |
parent | de5a30c5ff3acbcda7a46a3caba70a622308dbb2 (diff) | |
download | tangerine-wallet-browser-86f71d504cc3acd758958f883520fe913903a2c2.tar tangerine-wallet-browser-86f71d504cc3acd758958f883520fe913903a2c2.tar.gz tangerine-wallet-browser-86f71d504cc3acd758958f883520fe913903a2c2.tar.bz2 tangerine-wallet-browser-86f71d504cc3acd758958f883520fe913903a2c2.tar.lz tangerine-wallet-browser-86f71d504cc3acd758958f883520fe913903a2c2.tar.xz tangerine-wallet-browser-86f71d504cc3acd758958f883520fe913903a2c2.tar.zst tangerine-wallet-browser-86f71d504cc3acd758958f883520fe913903a2c2.zip |
Merge branch 'master' into i1144-moarrpc
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/tx-utils-test.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/unit/tx-utils-test.js b/test/unit/tx-utils-test.js new file mode 100644 index 000000000..65233e1d9 --- /dev/null +++ b/test/unit/tx-utils-test.js @@ -0,0 +1,26 @@ +const assert = require('assert') +const ethUtil = require('ethereumjs-util') +const BN = ethUtil.BN + +const TxUtils = require('../../app/scripts/lib/tx-utils') + + +describe('txUtils', function() { + let txUtils + + before(function() { + txUtils = new TxUtils() + }) + + describe('addGasBuffer', function() { + it('multiplies by 1.5', function() { + const input = '0x123fad' + const output = txUtils.addGasBuffer(input, '0x3d4c52') //0x3d4c52 is 4mil for dummy gas limit + + const inputBn = new BN(ethUtil.stripHexPrefix(input), 'hex') + const outputBn = new BN(ethUtil.stripHexPrefix(output), 'hex') + const expectedBn = inputBn.muln(1.5) + assert(outputBn.eq(expectedBn), 'returns 1.5 the input value') + }) + }) +}) |