aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-09-13 06:18:32 +0800
committerDan Finlay <dan@danfinlay.com>2016-09-13 06:18:32 +0800
commitc3d1404e72f4978db5b4522cb793ffd22653d9ff (patch)
tree3e8891623006b780bcec86e958b21048cbbb4e1a /test
parent784856532cd6c0ae09544b7dcd19755194fa9200 (diff)
downloadtangerine-wallet-browser-c3d1404e72f4978db5b4522cb793ffd22653d9ff.tar
tangerine-wallet-browser-c3d1404e72f4978db5b4522cb793ffd22653d9ff.tar.gz
tangerine-wallet-browser-c3d1404e72f4978db5b4522cb793ffd22653d9ff.tar.bz2
tangerine-wallet-browser-c3d1404e72f4978db5b4522cb793ffd22653d9ff.tar.lz
tangerine-wallet-browser-c3d1404e72f4978db5b4522cb793ffd22653d9ff.tar.xz
tangerine-wallet-browser-c3d1404e72f4978db5b4522cb793ffd22653d9ff.tar.zst
tangerine-wallet-browser-c3d1404e72f4978db5b4522cb793ffd22653d9ff.zip
Fix clearing of account cache on vault restore
Diffstat (limited to 'test')
-rw-r--r--test/unit/idStore-test.js14
1 files changed, 6 insertions, 8 deletions
diff --git a/test/unit/idStore-test.js b/test/unit/idStore-test.js
index 03b1d3b41..31da2cd3d 100644
--- a/test/unit/idStore-test.js
+++ b/test/unit/idStore-test.js
@@ -63,7 +63,7 @@ describe('IdentityStore', function() {
const salt = 'lightwalletSalt'
let password = 'secret!'
- let accounts = []
+ let accounts = {}
let idStore
var assertions = [
@@ -99,25 +99,22 @@ describe('IdentityStore', function() {
idStore = new IdentityStore({
configManager: configManagerGen(),
ethStore: {
- addAccount(acct) { accounts.push(ethUtil.addHexPrefix(acct)) },
+ addAccount(acct) { accounts[acct] = acct},
+ del(acct) { delete accounts[acct] },
},
})
})
- beforeEach(function() {
- accounts = []
- })
-
it('should enforce seed compliance with TestRPC', function (done) {
this.timeout(10000)
const tests = assertions.map((assertion) => {
return function (cb) {
- accounts = []
+
idStore.recoverFromSeed(password, assertion.seed, (err) => {
assert.ifError(err)
- var received = accounts[0].toLowerCase()
var expected = assertion.account.toLowerCase()
+ var received = accounts[expected].toLowerCase()
assert.equal(received, expected)
idStore.tryPassword(password, function (err) {
@@ -127,6 +124,7 @@ describe('IdentityStore', function() {
idStore.submitPassword(password, function(err, account) {
assert.ifError(err)
assert.equal(account, expected)
+ assert.equal(Object.keys(idStore._getAddresses()).length, 1, 'only one account on restore')
cb()
})
})