aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-03-26 03:41:18 +0800
committerDan Finlay <dan@danfinlay.com>2016-03-26 03:41:18 +0800
commit37fd45e5b70a66ff976cab0d1815374063e29d10 (patch)
tree563e18f391806e1c7ef956eabcdef101cc211ec4 /test
parentda31f4daed76a3457df12f94bbf2974621b70a0c (diff)
downloadtangerine-wallet-browser-37fd45e5b70a66ff976cab0d1815374063e29d10.tar
tangerine-wallet-browser-37fd45e5b70a66ff976cab0d1815374063e29d10.tar.gz
tangerine-wallet-browser-37fd45e5b70a66ff976cab0d1815374063e29d10.tar.bz2
tangerine-wallet-browser-37fd45e5b70a66ff976cab0d1815374063e29d10.tar.lz
tangerine-wallet-browser-37fd45e5b70a66ff976cab0d1815374063e29d10.tar.xz
tangerine-wallet-browser-37fd45e5b70a66ff976cab0d1815374063e29d10.tar.zst
tangerine-wallet-browser-37fd45e5b70a66ff976cab0d1815374063e29d10.zip
Convert to bip44 hdTrees
Added initial test just to verify we can recover the accounts we generate in this way. Still need to add compliance test to make sure this interoperates with testrpc's new mnemonic flag.
Diffstat (limited to 'test')
-rw-r--r--test/index.js57
1 files changed, 49 insertions, 8 deletions
diff --git a/test/index.js b/test/index.js
index 1ff7b673a..5a8df78b8 100644
--- a/test/index.js
+++ b/test/index.js
@@ -1,11 +1,52 @@
-var assert = require('assert');
-var idStore = require('../app/scripts/lib/idStore')
+var assert = require('assert')
+var IdentityStore = require('../app/scripts/lib/idStore')
+var jsdom = require('mocha-jsdom')
+jsdom()
describe('IdentityStore', function() {
- describe('#_createFirstWallet', function () {
- it('should return the expected keystore', function () {
- assert.equal(1,1)
- });
- });
-});
+ describe('#createNewVault', function () {
+ let idStore
+ let password = 'password123'
+ let entropy = 'entripppppyy duuude'
+ let seedWords
+ let accounts = []
+ let originalKeystore
+
+ before(function(done) {
+ window.localStorage = {} // Hacking localStorage support into JSDom
+
+ idStore = new IdentityStore({
+ addAccount(acct) { accounts.push(acct) },
+ })
+
+ idStore.createNewVault(password, entropy, (err, seeds) => {
+ seedWords = seeds
+ originalKeystore = idStore._idmgmt.keyStore
+ done()
+ })
+ })
+
+ describe('#recoverFromSeed', function() {
+
+ before(function() {
+ window.localStorage = {} // Hacking localStorage support into JSDom
+ accounts = []
+
+ idStore = new IdentityStore({
+ addAccount(acct) { accounts.push(acct) },
+ })
+ })
+
+ it('should return the expected keystore', function () {
+
+ idStore.recoverFromSeed(password, seedWords, (err) => {
+ assert.ifError(err)
+
+ let newKeystore = idStore._idmgmt.keyStore
+ assert.equal(newKeystore, originalKeystore)
+ })
+ })
+ })
+ })
+})