aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-09-11 03:35:52 +0800
committerDan Finlay <dan@danfinlay.com>2016-09-11 03:35:52 +0800
commit8922ae1a55d3c5bf743c85aec5e454cf189f94f1 (patch)
treef23606f5fa8a3f6a7d50cf41bb0512e336ef0ab6
parent1b77d5300b1ace16f96cf626d69925a26b5f0d29 (diff)
downloadtangerine-wallet-browser-8922ae1a55d3c5bf743c85aec5e454cf189f94f1.tar
tangerine-wallet-browser-8922ae1a55d3c5bf743c85aec5e454cf189f94f1.tar.gz
tangerine-wallet-browser-8922ae1a55d3c5bf743c85aec5e454cf189f94f1.tar.bz2
tangerine-wallet-browser-8922ae1a55d3c5bf743c85aec5e454cf189f94f1.tar.lz
tangerine-wallet-browser-8922ae1a55d3c5bf743c85aec5e454cf189f94f1.tar.xz
tangerine-wallet-browser-8922ae1a55d3c5bf743c85aec5e454cf189f94f1.tar.zst
tangerine-wallet-browser-8922ae1a55d3c5bf743c85aec5e454cf189f94f1.zip
Made bip44 assertions easier to add to
-rw-r--r--test/unit/idStore-test.js63
1 files changed, 36 insertions, 27 deletions
diff --git a/test/unit/idStore-test.js b/test/unit/idStore-test.js
index 1028e35ea..09d8f1b8f 100644
--- a/test/unit/idStore-test.js
+++ b/test/unit/idStore-test.js
@@ -2,6 +2,7 @@ var assert = require('assert')
var IdentityStore = require('../../app/scripts/lib/idStore')
var configManagerGen = require('../lib/mock-config-manager')
const ethUtil = require('ethereumjs-util')
+const async = require('async')
describe('IdentityStore', function() {
@@ -65,6 +66,29 @@ describe('IdentityStore', function() {
let accounts = []
let idStore
+ var assertions = [
+ {
+ seed: 'picnic injury awful upper eagle junk alert toss flower renew silly vague',
+ account: '0x5d8de92c205279c10e5669f797b853ccef4f739a',
+ },
+ {
+ seed: 'radar blur cabbage chef fix engine embark joy scheme fiction master release',
+ account: '0xac39b311dceb2a4b2f5d8461c1cdaf756f4f7ae9',
+ },
+ {
+ seed: 'phone coyote caught pattern found table wedding list tumble broccoli chief swing',
+ account: '0xb0e868f24bc7fec2bce2efc2b1c344d7569cd9d2',
+ },
+ {
+ seed: 'recycle tag bird palace blue village anxiety census cook soldier example music',
+ account: '0xab34a45920afe4af212b96ec51232aaa6a33f663',
+ },
+ {
+ seed: 'half glimpse tape cute harvest sweet bike voyage actual floor poet lazy',
+ account: '0x28e9044597b625ac4beda7250011670223de43b2',
+ }
+ ]
+
before(function() {
window.localStorage = {} // Hacking localStorage support into JSDom
@@ -80,36 +104,21 @@ describe('IdentityStore', function() {
accounts = []
})
- it('should return the expected first account', function (done) {
- let seedWords = 'picnic injury awful upper eagle junk alert toss flower renew silly vague'
- let firstAccount = '0x5d8de92c205279c10e5669f797b853ccef4f739a'
-
- idStore.recoverFromSeed(password, seedWords, (err) => {
- assert.ifError(err)
-
- assert.equal(accounts[0], firstAccount)
- done()
+ it('should enforce seed compliance with TestRPC', function (done) {
+ const tests = assertions.map((assertion) => {
+ return function (cb) {
+ idStore.recoverFromSeed(password, assertion.seed, (err) => {
+ assert.ifError(err)
+
+ console.log('comparing %s to %s', accounts[0], assertion.account)
+ assert.equal(accounts[0], assertion.account)
+ cb()
+ })
+ }
})
- })
-
- it('should return the expected second account', function (done) {
- const secondSeed = 'radar blur cabbage chef fix engine embark joy scheme fiction master release'
- const secondAcct = '0xac39b311dceb2a4b2f5d8461c1cdaf756f4f7ae9'
-
- idStore.recoverFromSeed(password, secondSeed, (err) => {
- assert.ifError(err)
- assert.equal(accounts[0], secondAcct)
- done()
- })
- })
-
- it('should return the expected third account', function (done) {
- const thirdSeed = 'phone coyote caught pattern found table wedding list tumble broccoli chief swing'
- const thirdAcct = '0xb0e868f24bc7fec2bce2efc2b1c344d7569cd9d2'
- idStore.recoverFromSeed(password, thirdSeed, (err) => {
+ async.series(tests, function(err, results) {
assert.ifError(err)
- assert.equal(accounts[0], thirdAcct)
done()
})
})