1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00

added test for preferences controller

This commit is contained in:
brunobar79 2018-07-16 16:08:19 -04:00
parent de21a49265
commit 41879a9835
2 changed files with 26 additions and 1 deletions

View File

@ -448,4 +448,4 @@ jobs:
steps:
- run:
name: All Tests Passed
command: echo 'weew - everything passed!'
command: echo 'weew - everything passed!'

View File

@ -52,6 +52,31 @@ describe('preferences controller', function () {
})
})
describe('removeAddress', function () {
it('should remove an address from state', function () {
preferencesController.setAddresses([
'0xda22le',
'0x7e57e2',
])
preferencesController.removeAddress('0xda22le')
assert.equal(preferencesController.store.getState().identities['0xda22le'], undefined)
})
it('should switch accounts if the selected address is removed', function () {
preferencesController.setAddresses([
'0xda22le',
'0x7e57e2',
])
preferencesController.setSelectedAddress('0x7e57e2')
preferencesController.removeAddress('0x7e57e2')
assert.equal(preferencesController.getSelectedAddress(), '0xda22le')
})
})
describe('setAccountLabel', function () {
it('should update a label for the given account', function () {
preferencesController.setAddresses([