diff options
author | Whymarrh Whitby <whymarrh.whitby@gmail.com> | 2018-04-19 11:33:51 +0800 |
---|---|---|
committer | Whymarrh Whitby <whymarrh.whitby@gmail.com> | 2018-05-17 23:27:39 +0800 |
commit | c54e4c719110c2033b7cc3757676f97ad3329d42 (patch) | |
tree | ba596e96730a3b8b617278696df9068af0612d70 /test | |
parent | cbe4d0d88c83ee1d8dd8efde537ee753bf19596a (diff) | |
download | tangerine-wallet-browser-c54e4c719110c2033b7cc3757676f97ad3329d42.tar tangerine-wallet-browser-c54e4c719110c2033b7cc3757676f97ad3329d42.tar.gz tangerine-wallet-browser-c54e4c719110c2033b7cc3757676f97ad3329d42.tar.bz2 tangerine-wallet-browser-c54e4c719110c2033b7cc3757676f97ad3329d42.tar.lz tangerine-wallet-browser-c54e4c719110c2033b7cc3757676f97ad3329d42.tar.xz tangerine-wallet-browser-c54e4c719110c2033b7cc3757676f97ad3329d42.tar.zst tangerine-wallet-browser-c54e4c719110c2033b7cc3757676f97ad3329d42.zip |
Add PreferencesController#setAddresses to update ids
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/preferences-controller-test.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/test/unit/preferences-controller-test.js b/test/unit/preferences-controller-test.js index 8ff1c8648..4b40b1159 100644 --- a/test/unit/preferences-controller-test.js +++ b/test/unit/preferences-controller-test.js @@ -8,6 +8,50 @@ describe('preferences controller', function () { preferencesController = new PreferencesController() }) + describe('setAddresses', function () { + it('should keep a map of addresses to names and addresses in the store', function () { + preferencesController.setAddresses([ + '0xda22le', + '0x7e57e2', + ]) + + const {identities} = preferencesController.store.getState() + assert.deepEqual(identities, { + '0xda22le': { + name: 'Account 1', + address: '0xda22le', + }, + '0x7e57e2': { + name: 'Account 2', + address: '0x7e57e2', + }, + }) + }) + + it('should replace its list of addresses', function () { + preferencesController.setAddresses([ + '0xda22le', + '0x7e57e2', + ]) + preferencesController.setAddresses([ + '0xda22le77', + '0x7e57e277', + ]) + + const {identities} = preferencesController.store.getState() + assert.deepEqual(identities, { + '0xda22le77': { + name: 'Account 1', + address: '0xda22le77', + }, + '0x7e57e277': { + name: 'Account 2', + address: '0x7e57e277', + }, + }) + }) + }) + describe('getTokens', function () { it('should return an empty list initially', async function () { await preferencesController.setSelectedAddress('0x7e57e2') |