aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2017-09-08 13:37:44 +0800
committerkumavis <aaron@kumavis.me>2017-09-08 13:37:44 +0800
commit671dafea9e8d379578c73672ba051205456219e3 (patch)
treec733017a12b83d70db21c61d16a07033ddefecbb /test
parent70401626e2544f254ddb06a21b5d3de7fdd7fb82 (diff)
parenta704e1d14370056a9a1a8af43c702bb00142532d (diff)
downloadtangerine-wallet-browser-671dafea9e8d379578c73672ba051205456219e3.tar
tangerine-wallet-browser-671dafea9e8d379578c73672ba051205456219e3.tar.gz
tangerine-wallet-browser-671dafea9e8d379578c73672ba051205456219e3.tar.bz2
tangerine-wallet-browser-671dafea9e8d379578c73672ba051205456219e3.tar.lz
tangerine-wallet-browser-671dafea9e8d379578c73672ba051205456219e3.tar.xz
tangerine-wallet-browser-671dafea9e8d379578c73672ba051205456219e3.tar.zst
tangerine-wallet-browser-671dafea9e8d379578c73672ba051205456219e3.zip
Merge branch 'master' of github.com:MetaMask/metamask-extension into filter-leak-fix
Diffstat (limited to 'test')
-rw-r--r--test/lib/mock-store.js4
-rw-r--r--test/unit/nonce-tracker-test.js19
-rw-r--r--test/unit/tx-state-history-helper-test.js26
3 files changed, 47 insertions, 2 deletions
diff --git a/test/lib/mock-store.js b/test/lib/mock-store.js
index 0d50e2d9c..8af8f6d23 100644
--- a/test/lib/mock-store.js
+++ b/test/lib/mock-store.js
@@ -1,7 +1,7 @@
const createStore = require('redux').createStore
const applyMiddleware = require('redux').applyMiddleware
-const thunkMiddleware = require('redux-thunk')
-const createLogger = require('redux-logger')
+const thunkMiddleware = require('redux-thunk').default
+const createLogger = require('redux-logger').createLogger
const rootReducer = function () {}
module.exports = configureStore
diff --git a/test/unit/nonce-tracker-test.js b/test/unit/nonce-tracker-test.js
index 3312a3bd0..8970cf84d 100644
--- a/test/unit/nonce-tracker-test.js
+++ b/test/unit/nonce-tracker-test.js
@@ -162,6 +162,25 @@ describe('Nonce Tracker', function () {
await nonceLock.releaseLock()
})
})
+
+ describe('Faq issue 67', function () {
+ beforeEach(function () {
+ const txGen = new MockTxGen()
+ const confirmedTxs = txGen.generate({ status: 'confirmed' }, { count: 64 })
+ const pendingTxs = txGen.generate({
+ status: 'submitted',
+ }, { count: 10 })
+ // 0x40 is 64 in hex:
+ nonceTracker = generateNonceTrackerWith(pendingTxs, [], '0x40')
+ })
+
+ it('should return nonce after network nonce', async function () {
+ this.timeout(15000)
+ const nonceLock = await nonceTracker.getNonceLock('0x7d3517b0d011698406d6e0aed8453f0be2697926')
+ assert.equal(nonceLock.nextNonce, '74', `nonce should be 74 got ${nonceLock.nextNonce}`)
+ await nonceLock.releaseLock()
+ })
+ })
})
})
diff --git a/test/unit/tx-state-history-helper-test.js b/test/unit/tx-state-history-helper-test.js
new file mode 100644
index 000000000..90cb10713
--- /dev/null
+++ b/test/unit/tx-state-history-helper-test.js
@@ -0,0 +1,26 @@
+const assert = require('assert')
+const clone = require('clone')
+const txStateHistoryHelper = require('../../app/scripts/lib/tx-state-history-helper')
+
+describe('deepCloneFromTxMeta', function () {
+ it('should clone deep', function () {
+ const input = {
+ foo: {
+ bar: {
+ bam: 'baz'
+ }
+ }
+ }
+ const output = txStateHistoryHelper.snapshotFromTxMeta(input)
+ assert('foo' in output, 'has a foo key')
+ assert('bar' in output.foo, 'has a bar key')
+ assert('bam' in output.foo.bar, 'has a bar key')
+ assert.equal(output.foo.bar.bam, 'baz', 'has a baz value')
+ })
+
+ it('should remove the history key', function () {
+ const input = { foo: 'bar', history: 'remembered' }
+ const output = txStateHistoryHelper.snapshotFromTxMeta(input)
+ assert(typeof output.history, 'undefined', 'should remove history')
+ })
+})