mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Add failing test for unknown identity entry
This commit is contained in:
parent
5d58f0e9a0
commit
797e63b37b
@ -45,7 +45,7 @@ describe('MetaMaskController', function () {
|
|||||||
encryptor: {
|
encryptor: {
|
||||||
encrypt: function (password, object) {
|
encrypt: function (password, object) {
|
||||||
this.object = object
|
this.object = object
|
||||||
return Promise.resolve()
|
return Promise.resolve('mock-encrypted')
|
||||||
},
|
},
|
||||||
decrypt: function () {
|
decrypt: function () {
|
||||||
return Promise.resolve(this.object)
|
return Promise.resolve(this.object)
|
||||||
@ -62,6 +62,31 @@ describe('MetaMaskController', function () {
|
|||||||
sandbox.restore()
|
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 () {
|
describe('#getGasPrice', function () {
|
||||||
|
|
||||||
it('gives the 50th percentile lowest accepted gas price from recentBlocksController', async 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 () {
|
it('errors when signing a message', async function () {
|
||||||
await metamaskController.signPersonalMessage(personalMessages[0].msgParams)
|
await metamaskController.signPersonalMessage(personalMessages[0].msgParams)
|
||||||
assert.equal(metamaskPersonalMsgs[msgId].status, 'signed')
|
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) {
|
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')
|
assert.equal(chunk.name, 'controller')
|
||||||
cb()
|
cb()
|
||||||
done()
|
done()
|
||||||
|
Loading…
Reference in New Issue
Block a user