aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2017-09-26 05:36:49 +0800
committerDan Finlay <dan@danfinlay.com>2017-09-26 05:36:49 +0800
commit8cd7329c91b047ef15c81b164075ea6c1d15b0df (patch)
treed51ed2a85a45ac23dbfb3595f4c8c13850be3b58 /test/unit
parent40f1d0868401662c42f6a031549c9b023427ccef (diff)
downloadtangerine-wallet-browser-8cd7329c91b047ef15c81b164075ea6c1d15b0df.tar
tangerine-wallet-browser-8cd7329c91b047ef15c81b164075ea6c1d15b0df.tar.gz
tangerine-wallet-browser-8cd7329c91b047ef15c81b164075ea6c1d15b0df.tar.bz2
tangerine-wallet-browser-8cd7329c91b047ef15c81b164075ea6c1d15b0df.tar.lz
tangerine-wallet-browser-8cd7329c91b047ef15c81b164075ea6c1d15b0df.tar.xz
tangerine-wallet-browser-8cd7329c91b047ef15c81b164075ea6c1d15b0df.tar.zst
tangerine-wallet-browser-8cd7329c91b047ef15c81b164075ea6c1d15b0df.zip
Implemented feedback
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/pending-balance-test.js20
1 files changed, 7 insertions, 13 deletions
diff --git a/test/unit/pending-balance-test.js b/test/unit/pending-balance-test.js
index dde30fecc..5048d487b 100644
--- a/test/unit/pending-balance-test.js
+++ b/test/unit/pending-balance-test.js
@@ -11,7 +11,7 @@ const ether = '0x' + etherBn.toString(16)
describe('PendingBalanceCalculator', function () {
let balanceCalculator
- describe('#valueFor(tx)', function () {
+ describe('#calculateMaxCost(tx)', function () {
it('returns a BN for a given tx value', function () {
const txGen = new MockTxGen()
pendingTxs = txGen.generate({
@@ -24,7 +24,7 @@ describe('PendingBalanceCalculator', function () {
}, { count: 1 })
const balanceCalculator = generateBalanceCalcWith([], zeroBn)
- const result = balanceCalculator.valueFor(pendingTxs[0])
+ const result = balanceCalculator.calculateMaxCost(pendingTxs[0])
assert.equal(result.toString(), etherBn.toString(), 'computes one ether')
})
@@ -40,8 +40,8 @@ describe('PendingBalanceCalculator', function () {
}, { count: 1 })
const balanceCalculator = generateBalanceCalcWith([], zeroBn)
- const result = balanceCalculator.valueFor(pendingTxs[0])
- assert.equal(result.toString(), '6', 'computes one ether')
+ const result = balanceCalculator.calculateMaxCost(pendingTxs[0])
+ assert.equal(result.toString(), '6', 'computes 6 wei of gas')
})
})
@@ -82,15 +82,9 @@ describe('PendingBalanceCalculator', function () {
})
function generateBalanceCalcWith (transactions, providerStub = zeroBn) {
- const getPendingTransactions = () => Promise.resolve(transactions)
- const getBalance = () => Promise.resolve(providerStub)
- providerResultStub.result = providerStub
- const provider = {
- sendAsync: (_, cb) => { cb(undefined, providerResultStub) },
- _blockTracker: {
- getCurrentBlock: () => '0x11b568',
- },
- }
+ const getPendingTransactions = async () => transactions
+ const getBalance = async () => providerStub
+
return new PendingBalanceCalculator({
getBalance,
getPendingTransactions,