diff options
author | kumavis <kumavis@users.noreply.github.com> | 2017-08-09 07:23:14 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-09 07:23:14 +0800 |
commit | 922ecb914963c420ef2acdb9e2db91444065f62f (patch) | |
tree | 9135982572ae502242d5cce39890593f1fec68f8 /test/unit/tx-utils-test.js | |
parent | 67e4855b9d79afb3046c6499f4610cb5a8b70837 (diff) | |
parent | 7db1f30590c9dbd01456517ebf0a24e1f76ddd40 (diff) | |
download | tangerine-wallet-browser-922ecb914963c420ef2acdb9e2db91444065f62f.tar tangerine-wallet-browser-922ecb914963c420ef2acdb9e2db91444065f62f.tar.gz tangerine-wallet-browser-922ecb914963c420ef2acdb9e2db91444065f62f.tar.bz2 tangerine-wallet-browser-922ecb914963c420ef2acdb9e2db91444065f62f.tar.lz tangerine-wallet-browser-922ecb914963c420ef2acdb9e2db91444065f62f.tar.xz tangerine-wallet-browser-922ecb914963c420ef2acdb9e2db91444065f62f.tar.zst tangerine-wallet-browser-922ecb914963c420ef2acdb9e2db91444065f62f.zip |
Merge branch 'master' into greenkeeper/initial
Diffstat (limited to 'test/unit/tx-utils-test.js')
-rw-r--r-- | test/unit/tx-utils-test.js | 58 |
1 files changed, 5 insertions, 53 deletions
diff --git a/test/unit/tx-utils-test.js b/test/unit/tx-utils-test.js index a43bcfb35..43128b977 100644 --- a/test/unit/tx-utils-test.js +++ b/test/unit/tx-utils-test.js @@ -1,7 +1,7 @@ const assert = require('assert') -const ethUtil = require('ethereumjs-util') -const BN = ethUtil.BN +const BN = require('bn.js') +const { hexToBn, bnToHex } = require('../../app/scripts/lib/util') const TxUtils = require('../../app/scripts/lib/tx-utils') @@ -16,44 +16,6 @@ describe('txUtils', function () { })) }) - describe('#sufficientBalance', function () { - it('returns true if max tx cost is equal to balance.', function () { - const tx = { - 'value': '0x1', - 'gas': '0x2', - 'gasPrice': '0x3', - } - const balance = '0x8' - - const result = txUtils.sufficientBalance(tx, balance) - assert.ok(result, 'sufficient balance found.') - }) - - it('returns true if max tx cost is less than balance.', function () { - const tx = { - 'value': '0x1', - 'gas': '0x2', - 'gasPrice': '0x3', - } - const balance = '0x9' - - const result = txUtils.sufficientBalance(tx, balance) - assert.ok(result, 'sufficient balance found.') - }) - - it('returns false if max tx cost is more than balance.', function () { - const tx = { - 'value': '0x1', - 'gas': '0x2', - 'gasPrice': '0x3', - } - const balance = '0x6' - - const result = txUtils.sufficientBalance(tx, balance) - assert.ok(!result, 'insufficient balance found.') - }) - }) - describe('chain Id', function () { it('prepares a transaction with the provided chainId', function () { const txParams = { @@ -96,7 +58,7 @@ describe('txUtils', function () { assert(outputBn.eq(expectedBn), 'returns the original estimatedGas value') }) - it('buffers up to reccomend gas limit reccomended ceiling', function () { + it('buffers up to recommend gas limit recommended ceiling', function () { // naive estimatedGas: 0x16e360 (1.5 mil) const inputHex = '0x16e360' // dummy gas limit: 0x1e8480 (2 mil) @@ -107,17 +69,7 @@ describe('txUtils', function () { // const inputBn = hexToBn(inputHex) // const outputBn = hexToBn(output) const expectedHex = bnToHex(ceilGasLimitBn) - assert.equal(output, expectedHex, 'returns the gas limit reccomended ceiling value') + assert.equal(output, expectedHex, 'returns the gas limit recommended ceiling value') }) }) -}) - -// util - -function hexToBn (inputHex) { - return new BN(ethUtil.stripHexPrefix(inputHex), 16) -} - -function bnToHex (inputBn) { - return ethUtil.addHexPrefix(inputBn.toString(16)) -} +})
\ No newline at end of file |