aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorfrankiebee <frankie.diamond@gmail.com>2017-09-30 03:54:05 +0800
committerfrankiebee <frankie.diamond@gmail.com>2017-09-30 03:54:05 +0800
commitac80eaca1fc9923cd5696282ba2bc6bace22ff83 (patch)
tree72a69440c6b4ab213ff494ab8ee7344f8fb9cfec /test/unit
parent77963e84170ee39c9d227e7cc4097b19f947099b (diff)
downloadtangerine-wallet-browser-ac80eaca1fc9923cd5696282ba2bc6bace22ff83.tar
tangerine-wallet-browser-ac80eaca1fc9923cd5696282ba2bc6bace22ff83.tar.gz
tangerine-wallet-browser-ac80eaca1fc9923cd5696282ba2bc6bace22ff83.tar.bz2
tangerine-wallet-browser-ac80eaca1fc9923cd5696282ba2bc6bace22ff83.tar.lz
tangerine-wallet-browser-ac80eaca1fc9923cd5696282ba2bc6bace22ff83.tar.xz
tangerine-wallet-browser-ac80eaca1fc9923cd5696282ba2bc6bace22ff83.tar.zst
tangerine-wallet-browser-ac80eaca1fc9923cd5696282ba2bc6bace22ff83.zip
pending-tx - dont check the balance to rebrodcast
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/pending-tx-test.js27
-rw-r--r--test/unit/tx-controller-test.js25
2 files changed, 1 insertions, 51 deletions
diff --git a/test/unit/pending-tx-test.js b/test/unit/pending-tx-test.js
index 1af464656..4da0eff5d 100644
--- a/test/unit/pending-tx-test.js
+++ b/test/unit/pending-tx-test.js
@@ -40,14 +40,12 @@ describe('PendingTransactionTracker', function () {
pendingTxTracker = new PendingTransactionTracker({
provider,
- getBalance: () => {},
nonceTracker: {
getGlobalLock: async () => {
return { releaseLock: () => {} }
}
},
getPendingTransactions: () => {return []},
- sufficientBalance: () => {},
publishTransaction: () => {},
})
})
@@ -213,30 +211,7 @@ describe('PendingTransactionTracker', function () {
pendingTxTracker.resubmitPendingTxs()
})
})
- describe('#_resubmitTx with a too-low balance', function () {
- it('should return before publishing the transaction because to low of balance', function (done) {
- const lowBalance = '0x0'
- pendingTxTracker.getBalance = (address) => {
- assert.equal(address, txMeta.txParams.from, 'Should pass the address')
- return lowBalance
- }
- pendingTxTracker.publishTransaction = async (rawTx) => {
- done(new Error('tried to publish transaction'))
- }
-
- // Stubbing out current account state:
- // Adding the fake tx:
- pendingTxTracker.once('tx:failed', (txId, err) => {
- assert(err, 'Should have a error')
- done()
- })
- pendingTxTracker._resubmitTx(txMeta)
- .catch((err) => {
- assert.ifError(err, 'should not throw an error')
- done(err)
- })
- })
-
+ describe('#_resubmitTx', function () {
it('should publishing the transaction', function (done) {
const enoughBalance = '0x100000'
pendingTxTracker.getBalance = (address) => {
diff --git a/test/unit/tx-controller-test.js b/test/unit/tx-controller-test.js
index 66772ff88..bb51ab01f 100644
--- a/test/unit/tx-controller-test.js
+++ b/test/unit/tx-controller-test.js
@@ -25,7 +25,6 @@ describe('Transaction Controller', function () {
networkStore: new ObservableStore(currentNetworkId),
txHistoryLimit: 10,
blockTracker: { getCurrentBlock: noop, on: noop, once: noop },
- accountTracker: { store: { getState: noop } },
signTransaction: (ethTx) => new Promise((resolve) => {
ethTx.sign(privKey)
resolve()
@@ -383,30 +382,6 @@ describe('Transaction Controller', function () {
})
})
- describe('#getBalance', function () {
- it('gets balance', function () {
- sinon.stub(txController.accountTracker.store, 'getState').callsFake(() => {
- return {
- accounts: {
- '0x1678a085c290ebd122dc42cba69373b5953b831d': {
- address: '0x1678a085c290ebd122dc42cba69373b5953b831d',
- balance: '0x00000000000000056bc75e2d63100000',
- code: '0x',
- nonce: '0x0',
- },
- '0xc684832530fcbddae4b4230a47e991ddcec2831d': {
- address: '0xc684832530fcbddae4b4230a47e991ddcec2831d',
- balance: '0x0',
- code: '0x',
- nonce: '0x0',
- },
- },
- }
- })
- assert.equal(txController.pendingTxTracker.getBalance('0x1678a085c290ebd122dc42cba69373b5953b831d'), '0x00000000000000056bc75e2d63100000')
- assert.equal(txController.pendingTxTracker.getBalance('0xc684832530fcbddae4b4230a47e991ddcec2831d'), '0x0')
- })
- })
describe('#getPendingTransactions', function () {
beforeEach(function () {