diff options
author | Dan Finlay <dan@danfinlay.com> | 2017-08-22 02:57:42 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2017-08-22 02:57:42 +0800 |
commit | 0f36e0e6da4027ea4b41510e9a81939d71b11586 (patch) | |
tree | 792eb6b94bab23bbb010383616050408448bf006 /test/unit | |
parent | 440101f2b561a92e81545140f0232b94af143831 (diff) | |
download | tangerine-wallet-browser-0f36e0e6da4027ea4b41510e9a81939d71b11586.tar tangerine-wallet-browser-0f36e0e6da4027ea4b41510e9a81939d71b11586.tar.gz tangerine-wallet-browser-0f36e0e6da4027ea4b41510e9a81939d71b11586.tar.bz2 tangerine-wallet-browser-0f36e0e6da4027ea4b41510e9a81939d71b11586.tar.lz tangerine-wallet-browser-0f36e0e6da4027ea4b41510e9a81939d71b11586.tar.xz tangerine-wallet-browser-0f36e0e6da4027ea4b41510e9a81939d71b11586.tar.zst tangerine-wallet-browser-0f36e0e6da4027ea4b41510e9a81939d71b11586.zip |
Fix test
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/nonce-tracker-test.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/test/unit/nonce-tracker-test.js b/test/unit/nonce-tracker-test.js index 3ed0eda9b..e8fa73b55 100644 --- a/test/unit/nonce-tracker-test.js +++ b/test/unit/nonce-tracker-test.js @@ -1,12 +1,12 @@ const assert = require('assert') const NonceTracker = require('../../app/scripts/lib/nonce-tracker') const MockTxGen = require('../lib/mock-tx-gen') +let providerResultStub = {} describe('Nonce Tracker', function () { let nonceTracker, provider let getPendingTransactions, pendingTxs let getConfirmedTransactions, confirmedTxs - let providerResultStub = {} describe('#getNonceLock', function () { @@ -15,7 +15,8 @@ describe('Nonce Tracker', function () { const txGen = new MockTxGen() confirmedTxs = txGen.generate({ status: 'confirmed' }, { count: 3 }) pendingTxs = txGen.generate({ status: 'pending' }, { count: 1 }) - nonceTracker = generateNonceTrackerWith(pendingTxs, confirmedTxs) + console.dir(txGen.txs) + nonceTracker = generateNonceTrackerWith(pendingTxs, confirmedTxs, '0x1') }) it('should work', async function () { @@ -27,7 +28,6 @@ describe('Nonce Tracker', function () { it('should use localNonce if network returns a nonce lower then a confirmed tx in state', async function () { this.timeout(15000) - providerResultStub.result = '0x1' const nonceLock = await nonceTracker.getNonceLock('0x7d3517b0d011698406d6e0aed8453f0be2697926') assert.equal(nonceLock.nextNonce, '4', 'nonce should be 4') await nonceLock.releaseLock() @@ -102,10 +102,10 @@ describe('Nonce Tracker', function () { }) }) -function generateNonceTrackerWith(pending, confirmed) { +function generateNonceTrackerWith(pending, confirmed, providerStub = '0x0') { const getPendingTransactions = () => pending const getConfirmedTransactions = () => confirmed - providerResultStub.result = '0x0' + providerResultStub.result = providerStub const provider = { sendAsync: (_, cb) => { cb(undefined, providerResultStub) }, _blockTracker: { |