aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorfrankiebee <frankie.diamond@gmail.com>2017-06-22 10:51:00 +0800
committerfrankiebee <frankie.diamond@gmail.com>2017-06-22 10:51:00 +0800
commit92df9965ebd4a833817c32fd32f7e4533ec7fe19 (patch)
treee7fdeb325f6bdd9ad57941d3c8d95e7a341afdb5 /test/unit
parentfa8c74fe9b19229580224815cc131611ee29027c (diff)
downloadtangerine-wallet-browser-92df9965ebd4a833817c32fd32f7e4533ec7fe19.tar
tangerine-wallet-browser-92df9965ebd4a833817c32fd32f7e4533ec7fe19.tar.gz
tangerine-wallet-browser-92df9965ebd4a833817c32fd32f7e4533ec7fe19.tar.bz2
tangerine-wallet-browser-92df9965ebd4a833817c32fd32f7e4533ec7fe19.tar.lz
tangerine-wallet-browser-92df9965ebd4a833817c32fd32f7e4533ec7fe19.tar.xz
tangerine-wallet-browser-92df9965ebd4a833817c32fd32f7e4533ec7fe19.tar.zst
tangerine-wallet-browser-92df9965ebd4a833817c32fd32f7e4533ec7fe19.zip
fix nonceTracker
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/nonce-tracker-test.js18
1 files changed, 6 insertions, 12 deletions
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()
})
})