mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Add test to account for prevention of identities duplication.
This commit is contained in:
parent
7dcab52a9e
commit
d85cc7ec4e
@ -2,11 +2,27 @@ const assert = require('assert')
|
||||
const extend = require('xtend')
|
||||
const AddressBookController = require('../../app/scripts/controllers/address-book')
|
||||
|
||||
const mockKeyringController = {
|
||||
memStore: {
|
||||
getState: function () {
|
||||
return {
|
||||
identities: {
|
||||
'0x0aaa' : {
|
||||
address: '0x0aaa',
|
||||
name: 'owned',
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
describe('address-book-controller', function() {
|
||||
var addressBookController
|
||||
|
||||
beforeEach(function() {
|
||||
addressBookController = new AddressBookController()
|
||||
addressBookController = new AddressBookController({}, mockKeyringController)
|
||||
})
|
||||
|
||||
describe('addres book management', function () {
|
||||
@ -30,6 +46,11 @@ describe('address-book-controller', function() {
|
||||
var addressBook = addressBookController._getAddressBook()
|
||||
assert.equal(addressBook.length, 1, 'incorrect address book length.')
|
||||
})
|
||||
it('should not add any identities that are under user control', function () {
|
||||
addressBookController.setAddressBook('0x0aaa', ' ')
|
||||
var addressBook = addressBookController._getAddressBook()
|
||||
assert.equal(addressBook.length, 0, 'incorrect address book length.')
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user