diff options
author | Dan Finlay <dan@danfinlay.com> | 2017-08-22 02:35:18 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2017-08-22 02:35:51 +0800 |
commit | c76194d7c315f9fb8e536328f97a2ac2dc411097 (patch) | |
tree | 25bac5fdfbe2b4db0540c489f1037a392ceb79e8 /test/unit | |
parent | 1ffb40648066189cd9e3abffc94299bbeecb6334 (diff) | |
download | tangerine-wallet-browser-c76194d7c315f9fb8e536328f97a2ac2dc411097.tar tangerine-wallet-browser-c76194d7c315f9fb8e536328f97a2ac2dc411097.tar.gz tangerine-wallet-browser-c76194d7c315f9fb8e536328f97a2ac2dc411097.tar.bz2 tangerine-wallet-browser-c76194d7c315f9fb8e536328f97a2ac2dc411097.tar.lz tangerine-wallet-browser-c76194d7c315f9fb8e536328f97a2ac2dc411097.tar.xz tangerine-wallet-browser-c76194d7c315f9fb8e536328f97a2ac2dc411097.tar.zst tangerine-wallet-browser-c76194d7c315f9fb8e536328f97a2ac2dc411097.zip |
Move mock txs to tx mocking class
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/nonce-tracker-test.js | 43 |
1 files changed, 8 insertions, 35 deletions
diff --git a/test/unit/nonce-tracker-test.js b/test/unit/nonce-tracker-test.js index 2171d859d..225cfbae5 100644 --- a/test/unit/nonce-tracker-test.js +++ b/test/unit/nonce-tracker-test.js @@ -1,5 +1,6 @@ const assert = require('assert') const NonceTracker = require('../../app/scripts/lib/nonce-tracker') +const MockTxGen = require('../lib/mock-tx-gen') describe('Nonce Tracker', function () { let nonceTracker, provider @@ -8,41 +9,9 @@ describe('Nonce Tracker', function () { let providerResultStub = {} beforeEach(function () { - pendingTxs = [{ - 'status': 'submitted', - 'txParams': { - 'from': '0x7d3517b0d011698406d6e0aed8453f0be2697926', - 'gas': '0x30d40', - 'value': '0x0', - 'nonce': '0x3', - }, - }] - confirmedTxs = [{ - 'status': 'confirmed', - 'txParams': { - 'from': '0x7d3517b0d011698406d6e0aed8453f0be2697926', - 'gas': '0x30d40', - 'value': '0x0', - 'nonce': '0x0', - }, - }, { - 'status': 'confirmed', - 'txParams': { - 'from': '0x7d3517b0d011698406d6e0aed8453f0be2697926', - 'gas': '0x30d40', - 'value': '0x0', - 'nonce': '0x1', - }, - }, { - 'status': 'confirmed', - 'txParams': { - 'from': '0x7d3517b0d011698406d6e0aed8453f0be2697926', - 'gas': '0x30d40', - 'value': '0x0', - 'nonce': '0x2', - }, - }] - + const txGen = new MockTxGen() + confirmedTxs = txGen.generate({ status: 'confirmed' }, { count: 3 }) + pendingTxs = txGen.generate({ status: 'pending' }, { count: 1 }) getPendingTransactions = () => pendingTxs getConfirmedTransactions = () => confirmedTxs @@ -68,6 +37,10 @@ describe('Nonce Tracker', function () { await nonceLock.releaseLock() }) + it('should return 0 if there are no previous transactions', async 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' |