aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorKevin Serrano <kevgagser@gmail.com>2017-03-11 02:48:07 +0800
committerKevin Serrano <kevgagser@gmail.com>2017-03-11 02:48:07 +0800
commitd85cc7ec4ef4e93d424ef4debbca1bb27b952a4e (patch)
treef6dce59d62f7984fdd626545b80018bbed95560c /test
parent7dcab52a9e6aa0532a712cb4e502846a383efc94 (diff)
downloadtangerine-wallet-browser-d85cc7ec4ef4e93d424ef4debbca1bb27b952a4e.tar
tangerine-wallet-browser-d85cc7ec4ef4e93d424ef4debbca1bb27b952a4e.tar.gz
tangerine-wallet-browser-d85cc7ec4ef4e93d424ef4debbca1bb27b952a4e.tar.bz2
tangerine-wallet-browser-d85cc7ec4ef4e93d424ef4debbca1bb27b952a4e.tar.lz
tangerine-wallet-browser-d85cc7ec4ef4e93d424ef4debbca1bb27b952a4e.tar.xz
tangerine-wallet-browser-d85cc7ec4ef4e93d424ef4debbca1bb27b952a4e.tar.zst
tangerine-wallet-browser-d85cc7ec4ef4e93d424ef4debbca1bb27b952a4e.zip
Add test to account for prevention of identities duplication.
Diffstat (limited to 'test')
-rw-r--r--test/unit/address-book-controller.js23
1 files changed, 22 insertions, 1 deletions
diff --git a/test/unit/address-book-controller.js b/test/unit/address-book-controller.js
index 51dc898b8..f345b0328 100644
--- a/test/unit/address-book-controller.js
+++ b/test/unit/address-book-controller.js
@@ -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.')
+ })
})
})
})