aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2017-09-27 12:42:30 +0800
committerkumavis <aaron@kumavis.me>2017-09-27 12:42:30 +0800
commit1877c0766c1f3ab46ec89dad0200fb8f75f52bae (patch)
tree44243d257dfb7f787882578fa14df8f01900fb45 /test
parent443b1a8eb7883b6799692ddc24d0555d49bd1787 (diff)
parent6ca519e97c4c282023ab6b7788715ff8d7ec8189 (diff)
downloadtangerine-wallet-browser-1877c0766c1f3ab46ec89dad0200fb8f75f52bae.tar
tangerine-wallet-browser-1877c0766c1f3ab46ec89dad0200fb8f75f52bae.tar.gz
tangerine-wallet-browser-1877c0766c1f3ab46ec89dad0200fb8f75f52bae.tar.bz2
tangerine-wallet-browser-1877c0766c1f3ab46ec89dad0200fb8f75f52bae.tar.lz
tangerine-wallet-browser-1877c0766c1f3ab46ec89dad0200fb8f75f52bae.tar.xz
tangerine-wallet-browser-1877c0766c1f3ab46ec89dad0200fb8f75f52bae.tar.zst
tangerine-wallet-browser-1877c0766c1f3ab46ec89dad0200fb8f75f52bae.zip
Merge branch 'master' of github.com:MetaMask/metamask-extension into BreakOutKeyringController
Diffstat (limited to 'test')
-rw-r--r--test/lib/mock-encryptor.js4
-rw-r--r--test/unit/pending-balance-test.js20
2 files changed, 11 insertions, 13 deletions
diff --git a/test/lib/mock-encryptor.js b/test/lib/mock-encryptor.js
index cdf13c507..ef229a82f 100644
--- a/test/lib/mock-encryptor.js
+++ b/test/lib/mock-encryptor.js
@@ -29,4 +29,8 @@ module.exports = {
return 'WHADDASALT!'
},
+ getRandomValues () {
+ return 'SOO RANDO!!!1'
+ }
+
}
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,