From 92df9965ebd4a833817c32fd32f7e4533ec7fe19 Mon Sep 17 00:00:00 2001 From: frankiebee Date: Wed, 21 Jun 2017 19:51:00 -0700 Subject: fix nonceTracker --- test/unit/nonce-tracker-test.js | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'test') diff --git a/test/unit/nonce-tracker-test.js b/test/unit/nonce-tracker-test.js index 5a05d6170..16cd6d008 100644 --- a/test/unit/nonce-tracker-test.js +++ b/test/unit/nonce-tracker-test.js @@ -3,31 +3,25 @@ const NonceTracker = require('../../app/scripts/lib/nonce-tracker') describe('Nonce Tracker', function () { let nonceTracker, provider, getPendingTransactions, pendingTxs - const noop = () => {} beforeEach(function () { - pendingTxs =[{ + pendingTxs = [{ 'status': 'submitted', 'txParams': { 'from': '0x7d3517b0d011698406d6e0aed8453f0be2697926', 'gas': '0x30d40', 'value': '0x0', - 'nonce': '0x1', + 'nonce': '0x0', }, }] getPendingTransactions = () => pendingTxs - provider = { sendAsync: (_, cb) => { cb(undefined , {result: '0x0'}) }, } + provider = { sendAsync: (_, cb) => { cb(undefined, {result: '0x0'}) } } nonceTracker = new NonceTracker({ blockTracker: { - getCurrentBlock: () => '0x11b568', - once: (...args) => { - setTimeout(() => { - args.pop()() - }, 5000) - } + getCurrentBlock: () => '0x11b568', }, provider, getPendingTransactions, @@ -38,8 +32,8 @@ describe('Nonce Tracker', function () { it('should work', async function (done) { this.timeout(15000) const nonceLock = await nonceTracker.getNonceLock('0x7d3517b0d011698406d6e0aed8453f0be2697926') - assert.equal(nonceLock.nextNonce, '2', 'nonce should be 2') - nonceLock.releaseLock() + assert.equal(nonceLock.nextNonce, '1', 'nonce should be 1') + await nonceLock.releaseLock() done() }) }) -- cgit v1.2.3