diff options
author | Dan Finlay <dan@danfinlay.com> | 2016-03-26 05:51:19 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2016-03-26 05:51:19 +0800 |
commit | a2c7ccafa6b4cdbd5f1725f7bf40189ad987cffa (patch) | |
tree | 6687de5f0f366f10482b6793a57e78303226487f /test | |
parent | 37fd45e5b70a66ff976cab0d1815374063e29d10 (diff) | |
download | tangerine-wallet-browser-a2c7ccafa6b4cdbd5f1725f7bf40189ad987cffa.tar tangerine-wallet-browser-a2c7ccafa6b4cdbd5f1725f7bf40189ad987cffa.tar.gz tangerine-wallet-browser-a2c7ccafa6b4cdbd5f1725f7bf40189ad987cffa.tar.bz2 tangerine-wallet-browser-a2c7ccafa6b4cdbd5f1725f7bf40189ad987cffa.tar.lz tangerine-wallet-browser-a2c7ccafa6b4cdbd5f1725f7bf40189ad987cffa.tar.xz tangerine-wallet-browser-a2c7ccafa6b4cdbd5f1725f7bf40189ad987cffa.tar.zst tangerine-wallet-browser-a2c7ccafa6b4cdbd5f1725f7bf40189ad987cffa.zip |
Implemented BIP44 compliance test.
Also added the hdPath that Christian had told me to our calls to the LightWallet, but this does not seem to have made us generate the same accounts as `testrpc` yet.
Diffstat (limited to 'test')
-rw-r--r-- | test/helper.js | 4 | ||||
-rw-r--r-- | test/unit/idStore-test.js (renamed from test/index.js) | 37 |
2 files changed, 37 insertions, 4 deletions
diff --git a/test/helper.js b/test/helper.js new file mode 100644 index 000000000..7746b90e0 --- /dev/null +++ b/test/helper.js @@ -0,0 +1,4 @@ +require('mocha-sinon')() +var jsdom = require('mocha-jsdom') +jsdom() + diff --git a/test/index.js b/test/unit/idStore-test.js index 5a8df78b8..4494bf505 100644 --- a/test/index.js +++ b/test/unit/idStore-test.js @@ -1,7 +1,5 @@ var assert = require('assert') -var IdentityStore = require('../app/scripts/lib/idStore') -var jsdom = require('mocha-jsdom') -jsdom() +var IdentityStore = require('../../app/scripts/lib/idStore') describe('IdentityStore', function() { @@ -38,15 +36,46 @@ describe('IdentityStore', function() { }) }) - it('should return the expected keystore', function () { + it('should return the expected keystore', function (done) { idStore.recoverFromSeed(password, seedWords, (err) => { assert.ifError(err) let newKeystore = idStore._idmgmt.keyStore assert.equal(newKeystore, originalKeystore) + done() }) }) }) }) + + describe('#recoverFromSeed BIP44 compliance', function() { + let seedWords = 'picnic injury awful upper eagle junk alert toss flower renew silly vague' + let firstAccount = '0xaceef0221414801dde7f732196b1c9d8ea60b637' + let password = 'secret!' + let accounts = [] + let idStore + + before(function() { + window.localStorage = {} // Hacking localStorage support into JSDom + + idStore = new IdentityStore({ + addAccount(acct) { + console.log(`pushing account ${acct}`) + accounts.push(acct) + }, + }) + }) + + it('should return the expected first account', function (done) { + + idStore.recoverFromSeed(password, seedWords, (err) => { + assert.ifError(err) + + let newKeystore = idStore._idmgmt.keyStore + assert.equal(accounts[0], firstAccount) + done() + }) + }) + }) }) |