From fbcba8f019313c3b02429043578e044046c6cc68 Mon Sep 17 00:00:00 2001 From: Esteban MIno Date: Mon, 30 Jul 2018 19:09:17 -0400 Subject: create tokens storage when setadresses --- .../app/controllers/preferences-controller-test.js | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'test') diff --git a/test/unit/app/controllers/preferences-controller-test.js b/test/unit/app/controllers/preferences-controller-test.js index dcf56e91f..9b2c846bd 100644 --- a/test/unit/app/controllers/preferences-controller-test.js +++ b/test/unit/app/controllers/preferences-controller-test.js @@ -31,6 +31,20 @@ describe('preferences controller', function () { }) }) + it('should create account tokens for each account in the store', function () { + preferencesController.setAddresses([ + '0xda22le', + '0x7e57e2', + ]) + + const accountTokens = preferencesController.store.getState().accountTokens + + assert.deepEqual(accountTokens, { + '0xda22le': {}, + '0x7e57e2': {}, + }) + }) + it('should replace its list of addresses', function () { preferencesController.setAddresses([ '0xda22le', @@ -67,6 +81,17 @@ describe('preferences controller', function () { assert.equal(preferencesController.store.getState().identities['0xda22le'], undefined) }) + it('should remove an address from state and respective tokens', function () { + preferencesController.setAddresses([ + '0xda22le', + '0x7e57e2', + ]) + + preferencesController.removeAddress('0xda22le') + + assert.equal(preferencesController.store.getState().accountTokens['0xda22le'], undefined) + }) + it('should switch accounts if the selected address is removed', function () { preferencesController.setAddresses([ '0xda22le', -- cgit v1.2.3