aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2017-08-22 02:59:51 +0800
committerDan Finlay <dan@danfinlay.com>2017-08-22 02:59:51 +0800
commitbb24f07b1759eb46fa4e4f733c348f1b87521eb6 (patch)
treec41b2dbcdbd6a881e4efacb928a30c71fa715673 /test
parent0f36e0e6da4027ea4b41510e9a81939d71b11586 (diff)
downloadtangerine-wallet-browser-bb24f07b1759eb46fa4e4f733c348f1b87521eb6.tar
tangerine-wallet-browser-bb24f07b1759eb46fa4e4f733c348f1b87521eb6.tar.gz
tangerine-wallet-browser-bb24f07b1759eb46fa4e4f733c348f1b87521eb6.tar.bz2
tangerine-wallet-browser-bb24f07b1759eb46fa4e4f733c348f1b87521eb6.tar.lz
tangerine-wallet-browser-bb24f07b1759eb46fa4e4f733c348f1b87521eb6.tar.xz
tangerine-wallet-browser-bb24f07b1759eb46fa4e4f733c348f1b87521eb6.tar.zst
tangerine-wallet-browser-bb24f07b1759eb46fa4e4f733c348f1b87521eb6.zip
When network nonce is highest, it should be used.
Diffstat (limited to 'test')
-rw-r--r--test/unit/nonce-tracker-test.js19
1 files changed, 15 insertions, 4 deletions
diff --git a/test/unit/nonce-tracker-test.js b/test/unit/nonce-tracker-test.js
index e8fa73b55..78fdee209 100644
--- a/test/unit/nonce-tracker-test.js
+++ b/test/unit/nonce-tracker-test.js
@@ -15,7 +15,6 @@ describe('Nonce Tracker', function () {
const txGen = new MockTxGen()
confirmedTxs = txGen.generate({ status: 'confirmed' }, { count: 3 })
pendingTxs = txGen.generate({ status: 'pending' }, { count: 1 })
- console.dir(txGen.txs)
nonceTracker = generateNonceTrackerWith(pendingTxs, confirmedTxs, '0x1')
})
@@ -62,7 +61,6 @@ describe('Nonce Tracker', function () {
it('should return nonce after those', async function () {
this.timeout(15000)
const nonceLock = await nonceTracker.getNonceLock('0x7d3517b0d011698406d6e0aed8453f0be2697926')
- console.dir(nonceLock.nextNonce)
assert.equal(nonceLock.nextNonce, '2', 'nonce should be 2')
await nonceLock.releaseLock()
})
@@ -78,7 +76,6 @@ describe('Nonce Tracker', function () {
it('should return nonce after those', async function () {
this.timeout(15000)
const nonceLock = await nonceTracker.getNonceLock('0x7d3517b0d011698406d6e0aed8453f0be2697926')
- console.dir(nonceLock.nextNonce)
assert.equal(nonceLock.nextNonce, '2', 'nonce should be 2')
await nonceLock.releaseLock()
})
@@ -94,11 +91,25 @@ describe('Nonce Tracker', function () {
it('should return nonce after those', async function () {
this.timeout(15000)
const nonceLock = await nonceTracker.getNonceLock('0x7d3517b0d011698406d6e0aed8453f0be2697926')
- console.dir(nonceLock.nextNonce)
assert.equal(nonceLock.nextNonce, '2', 'nonce should be 2')
await nonceLock.releaseLock()
})
})
+
+ describe('when provider nonce is higher than other metrics', function () {
+ beforeEach(function () {
+ const txGen = new MockTxGen()
+ pendingTxs = txGen.generate({ status: 'pending' }, { count: 2 })
+ nonceTracker = generateNonceTrackerWith(pendingTxs, [], '0x05')
+ })
+
+ it('should return nonce after those', async function () {
+ this.timeout(15000)
+ const nonceLock = await nonceTracker.getNonceLock('0x7d3517b0d011698406d6e0aed8453f0be2697926')
+ assert.equal(nonceLock.nextNonce, '6', 'nonce should be 6')
+ await nonceLock.releaseLock()
+ })
+ })
})
})