aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/app/controllers/metamask-controller-test.js
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2018-06-07 02:08:29 +0800
committerkumavis <aaron@kumavis.me>2018-06-07 02:08:29 +0800
commit9d77b0a19648fa5c4de594bbecaab2137d5d5658 (patch)
treefe87a5798021ac1b3332a3a13a70f5c4a930e126 /test/unit/app/controllers/metamask-controller-test.js
parent32293a959c367ce5dd585111d4ee0d873072c830 (diff)
parentc2e3194dbf4e2a3fd2bdffb3300ec0cd822dc78e (diff)
downloadtangerine-wallet-browser-9d77b0a19648fa5c4de594bbecaab2137d5d5658.tar
tangerine-wallet-browser-9d77b0a19648fa5c4de594bbecaab2137d5d5658.tar.gz
tangerine-wallet-browser-9d77b0a19648fa5c4de594bbecaab2137d5d5658.tar.bz2
tangerine-wallet-browser-9d77b0a19648fa5c4de594bbecaab2137d5d5658.tar.lz
tangerine-wallet-browser-9d77b0a19648fa5c4de594bbecaab2137d5d5658.tar.xz
tangerine-wallet-browser-9d77b0a19648fa5c4de594bbecaab2137d5d5658.tar.zst
tangerine-wallet-browser-9d77b0a19648fa5c4de594bbecaab2137d5d5658.zip
Merge branch 'develop' of github.com:MetaMask/metamask-extension into network-remove-provider-engine
Diffstat (limited to 'test/unit/app/controllers/metamask-controller-test.js')
-rw-r--r--test/unit/app/controllers/metamask-controller-test.js27
1 files changed, 26 insertions, 1 deletions
diff --git a/test/unit/app/controllers/metamask-controller-test.js b/test/unit/app/controllers/metamask-controller-test.js
index 1b2c95f48..13d74bce1 100644
--- a/test/unit/app/controllers/metamask-controller-test.js
+++ b/test/unit/app/controllers/metamask-controller-test.js
@@ -47,7 +47,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)
@@ -64,6 +64,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 () {