diff options
author | Kevin Serrano <kevgagser@gmail.com> | 2017-03-09 01:35:51 +0800 |
---|---|---|
committer | Kevin Serrano <kevgagser@gmail.com> | 2017-03-09 01:35:51 +0800 |
commit | 6fd3d6e0d0887ac01760b436be5dfabc89e28960 (patch) | |
tree | 42c6db90a39fb691f26ec8443bd18114ee7cff4d /test/unit/tx-utils-test.js | |
parent | 21769a008ccc5fdc2ac5d23a37d401a1d2a20694 (diff) | |
parent | 86f71d504cc3acd758958f883520fe913903a2c2 (diff) | |
download | tangerine-wallet-browser-6fd3d6e0d0887ac01760b436be5dfabc89e28960.tar.gz tangerine-wallet-browser-6fd3d6e0d0887ac01760b436be5dfabc89e28960.tar.zst tangerine-wallet-browser-6fd3d6e0d0887ac01760b436be5dfabc89e28960.zip |
Merge branch 'i1144-moarrpc' of github.com:MetaMask/metamask-plugin into i1144-moarrpc
Diffstat (limited to 'test/unit/tx-utils-test.js')
-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') + }) + }) +}) |