added test for preferences controller

feature/default_network_editable
brunobar79 6 years ago
parent de21a49265
commit 41879a9835
  1. 2
      .circleci/config.yml
  2. 25
      test/unit/app/controllers/preferences-controller-test.js

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

@ -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 () { describe('setAccountLabel', function () {
it('should update a label for the given account', function () { it('should update a label for the given account', function () {
preferencesController.setAddresses([ preferencesController.setAddresses([

Loading…
Cancel
Save