diff options
author | Dan Finlay <dan@danfinlay.com> | 2017-06-13 08:06:39 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2017-06-13 08:17:16 +0800 |
commit | a741cc4fc4fb68e3f460c70ea848bdf3d2d2c894 (patch) | |
tree | 58652d4789e71a47a763096e746bd25904d91bfe /test/unit/tx-utils-test.js | |
parent | d05d9a5f57b9311d6f29539233f9065330e8bda4 (diff) | |
parent | bbe0c73dca45542b519036bec2bae5feb1e55485 (diff) | |
download | tangerine-wallet-browser-a741cc4fc4fb68e3f460c70ea848bdf3d2d2c894.tar.gz tangerine-wallet-browser-a741cc4fc4fb68e3f460c70ea848bdf3d2d2c894.tar.zst tangerine-wallet-browser-a741cc4fc4fb68e3f460c70ea848bdf3d2d2c894.zip |
Merge branch 'master' into AddTokenList
Diffstat (limited to 'test/unit/tx-utils-test.js')
-rw-r--r-- | test/unit/tx-utils-test.js | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/test/unit/tx-utils-test.js b/test/unit/tx-utils-test.js index 93e9e4134..7ace1f587 100644 --- a/test/unit/tx-utils-test.js +++ b/test/unit/tx-utils-test.js @@ -5,15 +5,19 @@ const BN = ethUtil.BN const TxUtils = require('../../app/scripts/lib/tx-utils') -describe('txUtils', function() { +describe('txUtils', function () { let txUtils - before(function() { - txUtils = new TxUtils() + before(function () { + txUtils = new TxUtils(new Proxy({}, { + get: (obj, name) => { + return () => {} + }, + })) }) - describe('chain Id', function() { - it('prepares a transaction with the provided chainId', function() { + describe('chain Id', function () { + it('prepares a transaction with the provided chainId', function () { const txParams = { to: '0x70ad465e0bab6504002ad58c744ed89c7da38524', from: '0x69ad465e0bab6504002ad58c744ed89c7da38525', @@ -29,8 +33,8 @@ describe('txUtils', function() { }) }) - describe('addGasBuffer', function() { - it('multiplies by 1.5, when within block gas limit', function() { + describe('addGasBuffer', function () { + it('multiplies by 1.5, when within block gas limit', function () { // naive estimatedGas: 0x16e360 (1.5 mil) const inputHex = '0x16e360' // dummy gas limit: 0x3d4c52 (4 mil) @@ -41,20 +45,20 @@ describe('txUtils', function() { const expectedBn = inputBn.muln(1.5) assert(outputBn.eq(expectedBn), 'returns 1.5 the input value') }) - - it('uses original estimatedGas, when above block gas limit', function() { + + it('uses original estimatedGas, when above block gas limit', function () { // naive estimatedGas: 0x16e360 (1.5 mil) const inputHex = '0x16e360' // dummy gas limit: 0x0f4240 (1 mil) const blockGasLimitHex = '0x0f4240' const output = txUtils.addGasBuffer(inputHex, blockGasLimitHex) - const inputBn = hexToBn(inputHex) + // const inputBn = hexToBn(inputHex) const outputBn = hexToBn(output) const expectedBn = hexToBn(inputHex) assert(outputBn.eq(expectedBn), 'returns the original estimatedGas value') }) - it('buffers up to reccomend gas limit reccomended ceiling', function() { + it('buffers up to reccomend gas limit reccomended ceiling', function () { // naive estimatedGas: 0x16e360 (1.5 mil) const inputHex = '0x16e360' // dummy gas limit: 0x1e8480 (2 mil) @@ -72,10 +76,10 @@ describe('txUtils', function() { // util -function hexToBn(inputHex) { +function hexToBn (inputHex) { return new BN(ethUtil.stripHexPrefix(inputHex), 16) } -function bnToHex(inputBn) { +function bnToHex (inputBn) { return ethUtil.addHexPrefix(inputBn.toString(16)) -}
\ No newline at end of file +} |