aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorfrankiebee <frankie.diamond@gmail.com>2017-03-29 09:02:39 +0800
committerfrankiebee <frankie.diamond@gmail.com>2017-03-29 09:02:39 +0800
commita20a237282c38da86b03625d08b48c2e58e83523 (patch)
tree65c58173cf8e0da53dbb6b9f18014ed8c1babf9c /test/unit
parent79248ae5cd3fb1314c5a7ff71c05f9dbe7b3a4cd (diff)
parent7c09bde4120d1063df762076d41d2e9921dd3c0e (diff)
downloadtangerine-wallet-browser-a20a237282c38da86b03625d08b48c2e58e83523.tar
tangerine-wallet-browser-a20a237282c38da86b03625d08b48c2e58e83523.tar.gz
tangerine-wallet-browser-a20a237282c38da86b03625d08b48c2e58e83523.tar.bz2
tangerine-wallet-browser-a20a237282c38da86b03625d08b48c2e58e83523.tar.lz
tangerine-wallet-browser-a20a237282c38da86b03625d08b48c2e58e83523.tar.xz
tangerine-wallet-browser-a20a237282c38da86b03625d08b48c2e58e83523.tar.zst
tangerine-wallet-browser-a20a237282c38da86b03625d08b48c2e58e83523.zip
Merge branch 'master' into mascara
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/account-link-test.js12
-rw-r--r--test/unit/explorer-link-test.js9
-rw-r--r--test/unit/migrations-test.js7
-rw-r--r--test/unit/tx-manager-test.js11
4 files changed, 31 insertions, 8 deletions
diff --git a/test/unit/account-link-test.js b/test/unit/account-link-test.js
index 4ea12e002..803a70f37 100644
--- a/test/unit/account-link-test.js
+++ b/test/unit/account-link-test.js
@@ -3,15 +3,15 @@ var linkGen = require('../../ui/lib/account-link')
describe('account-link', function() {
- it('adds morden prefix to morden test network', function() {
- var result = linkGen('account', '2')
- assert.notEqual(result.indexOf('morden'), -1, 'testnet included')
+ it('adds ropsten prefix to ropsten test network', function() {
+ var result = linkGen('account', '3')
+ assert.notEqual(result.indexOf('ropsten'), -1, 'ropsten included')
assert.notEqual(result.indexOf('account'), -1, 'account included')
})
- it('adds testnet prefix to ropsten test network', function() {
- var result = linkGen('account', '3')
- assert.notEqual(result.indexOf('testnet'), -1, 'testnet included')
+ it('adds kovan prefix to kovan test network', function() {
+ var result = linkGen('account', '42')
+ assert.notEqual(result.indexOf('kovan'), -1, 'kovan included')
assert.notEqual(result.indexOf('account'), -1, 'account included')
})
diff --git a/test/unit/explorer-link-test.js b/test/unit/explorer-link-test.js
index 8aa58bff9..4f0230c2c 100644
--- a/test/unit/explorer-link-test.js
+++ b/test/unit/explorer-link-test.js
@@ -3,9 +3,14 @@ var linkGen = require('../../ui/lib/explorer-link')
describe('explorer-link', function() {
- it('adds testnet prefix to morden test network', function() {
+ it('adds ropsten prefix to ropsten test network', function() {
var result = linkGen('hash', '3')
- assert.notEqual(result.indexOf('testnet'), -1, 'testnet injected')
+ assert.notEqual(result.indexOf('ropsten'), -1, 'ropsten injected')
+ })
+
+ it('adds kovan prefix to kovan test network', function() {
+ var result = linkGen('hash', '42')
+ assert.notEqual(result.indexOf('kovan'), -1, 'kovan injected')
})
})
diff --git a/test/unit/migrations-test.js b/test/unit/migrations-test.js
index d2a83be77..ccd1477b0 100644
--- a/test/unit/migrations-test.js
+++ b/test/unit/migrations-test.js
@@ -15,6 +15,8 @@ const migration8 = require(path.join('..', '..', 'app', 'scripts', 'migrations',
const migration9 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '009'))
const migration10 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '010'))
const migration11 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '011'))
+const migration12 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '012'))
+
const oldTestRpc = 'https://rawtestrpc.metamask.io/'
const newTestRpc = 'https://testrpc.metamask.io/'
@@ -91,6 +93,11 @@ describe('wallet1 is migrated successfully', () => {
}).then((eleventhResult) => {
assert.equal(eleventhResult.data.isDisclaimerConfirmed, null, 'isDisclaimerConfirmed should not exist')
assert.equal(eleventhResult.data.TOSHash, null, 'TOSHash should not exist')
+
+ return migration12.migrate(eleventhResult)
+ }).then((twelfthResult) => {
+ assert.equal(twelfthResult.data.NoticeController.noticesList[0].body, '', 'notices that have been read should have an empty body.')
+ assert.equal(twelfthResult.data.NoticeController.noticesList[1].body, 'nonempty', 'notices that have not been read should not have an empty body.')
})
})
diff --git a/test/unit/tx-manager-test.js b/test/unit/tx-manager-test.js
index f64f048e3..d4bffdd9b 100644
--- a/test/unit/tx-manager-test.js
+++ b/test/unit/tx-manager-test.js
@@ -59,6 +59,17 @@ describe('Transaction Manager', function() {
assert.equal(result[0].id, 1)
})
+ it('does not override txs from other networks', function() {
+ var tx = { id: 1, status: 'confirmed', metamaskNetworkId: 'unit test', txParams: {} }
+ var tx2 = { id: 2, status: 'confirmed', metamaskNetworkId: 'another net', txParams: {} }
+ txManager.addTx(tx, noop)
+ txManager.addTx(tx2, noop)
+ var result = txManager.getFullTxList()
+ var result2 = txManager.getTxList()
+ assert.equal(result.length, 2, 'txs were deleted')
+ assert.equal(result2.length, 1, 'incorrect number of txs on network.')
+ })
+
it('cuts off early txs beyond a limit', function() {
const limit = txManager.txHistoryLimit
for (let i = 0; i < limit + 1; i++) {