aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/app/controllers/metamask-controller-test.js
diff options
context:
space:
mode:
authorBruno <brunobar79@gmail.com>2018-06-06 09:37:45 +0800
committerBruno <brunobar79@gmail.com>2018-06-06 09:37:45 +0800
commit4371801083e63838b6000a6818b418e36c39f539 (patch)
treec2a9e3c68605ca4b5a8feaf0d2f0cb6677d78b15 /test/unit/app/controllers/metamask-controller-test.js
parentde9672726833e26ea96d198c0d9f1464015614f5 (diff)
parentc2e3194dbf4e2a3fd2bdffb3300ec0cd822dc78e (diff)
downloadtangerine-wallet-browser-4371801083e63838b6000a6818b418e36c39f539.tar.gz
tangerine-wallet-browser-4371801083e63838b6000a6818b418e36c39f539.tar.zst
tangerine-wallet-browser-4371801083e63838b6000a6818b418e36c39f539.zip
Merge remote-tracking branch 'upstream/develop' into develop
Diffstat (limited to 'test/unit/app/controllers/metamask-controller-test.js')
-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()