aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/app
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2018-06-05 04:28:46 +0800
committerDan Finlay <dan@danfinlay.com>2018-06-05 04:28:46 +0800
commit797e63b37bc10b2aa3cb78e65024c4a68c099f0b (patch)
treeacd18e6c74b46394e72cf9d2a5de8b34287e6d91 /test/unit/app
parent5d58f0e9a02872cff298b8b9604c395688fd6c6c (diff)
downloadtangerine-wallet-browser-797e63b37bc10b2aa3cb78e65024c4a68c099f0b.tar
tangerine-wallet-browser-797e63b37bc10b2aa3cb78e65024c4a68c099f0b.tar.gz
tangerine-wallet-browser-797e63b37bc10b2aa3cb78e65024c4a68c099f0b.tar.bz2
tangerine-wallet-browser-797e63b37bc10b2aa3cb78e65024c4a68c099f0b.tar.lz
tangerine-wallet-browser-797e63b37bc10b2aa3cb78e65024c4a68c099f0b.tar.xz
tangerine-wallet-browser-797e63b37bc10b2aa3cb78e65024c4a68c099f0b.tar.zst
tangerine-wallet-browser-797e63b37bc10b2aa3cb78e65024c4a68c099f0b.zip
Add failing test for unknown identity entry
Diffstat (limited to 'test/unit/app')
-rw-r--r--test/unit/app/controllers/metamask-controller-test.js31
1 files changed, 28 insertions, 3 deletions
diff --git a/test/unit/app/controllers/metamask-controller-test.js b/test/unit/app/controllers/metamask-controller-test.js
index 4bc16e65e..266c3f258 100644
--- a/test/unit/app/controllers/metamask-controller-test.js
+++ b/test/unit/app/controllers/metamask-controller-test.js
@@ -45,7 +45,7 @@ describe('MetaMaskController', function () {
encryptor: {
encrypt: function (password, object) {
this.object = object
- return Promise.resolve()
+ return Promise.resolve('mock-encrypted')
},
decrypt: function () {
return Promise.resolve(this.object)
@@ -62,6 +62,31 @@ describe('MetaMaskController', function () {
sandbox.restore()
})
+ describe('submitPassword', function () {
+ const password = 'password'
+
+ beforeEach(async function () {
+ await metamaskController.createNewVaultAndKeychain(password)
+ })
+
+ it('removes any identities that do not correspond to known accounts.', async function () {
+ const fakeAddress = '0xbad0'
+ metamaskController.preferencesController.addAddresses([fakeAddress])
+ await metamaskController.submitPassword(password)
+
+ const identities = Object.keys(metamaskController.preferencesController.store.getState().identities)
+ const addresses = await metamaskController.keyringController.getAccounts()
+
+ identities.forEach((identity) => {
+ assert.ok(addresses.includes(identity), `addresses should include all IDs: ${identity}`)
+ })
+
+ addresses.forEach((address) => {
+ assert.ok(identities.includes(address), `identities should include all Addresses: ${address}`)
+ })
+ })
+ })
+
describe('#getGasPrice', function () {
it('gives the 50th percentile lowest accepted gas price from recentBlocksController', async function () {
@@ -479,7 +504,7 @@ describe('MetaMaskController', function () {
it('errors when signing a message', async function () {
await metamaskController.signPersonalMessage(personalMessages[0].msgParams)
assert.equal(metamaskPersonalMsgs[msgId].status, 'signed')
- assert.equal(metamaskPersonalMsgs[msgId].rawSig, '0x6a1b65e2b8ed53cf398a769fad24738f9fbe29841fe6854e226953542c4b6a173473cb152b6b1ae5f06d601d45dd699a129b0a8ca84e78b423031db5baa734741b')
+ assert.equal(metamaskPersonalMsgs[msgId].rawSig, '0x6a1b65e2b8ed53cf398a769fad24738f9fbe29841fe6854e226953542c4b6a173473cb152b6b1ae5f06d601d45dd699a129b0a8ca84e78b423031db5baa734741b')
})
})
@@ -513,7 +538,7 @@ describe('MetaMaskController', function () {
})
it('sets up controller dnode api for trusted communication', function (done) {
- streamTest = createThoughStream((chunk, enc, cb) => {
+ streamTest = createThoughStream((chunk, enc, cb) => {
assert.equal(chunk.name, 'controller')
cb()
done()