Remove unnecessary unlock step (#12840)

As part of the unlock process, currently the seed phrase is retrieved
from the background then discarded. This step is pointless, so it has
been deleted.
feature/default_network_editable
Mark Stacey 3 years ago committed by GitHub
parent 2856ea7606
commit 8835642c6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      ui/store/actions.js
  2. 37
      ui/store/actions.test.js

@ -69,19 +69,6 @@ export function tryUnlockMetamask(password) {
dispatch(unlockSucceeded());
return forceUpdateMetamaskState(dispatch);
})
.then(() => {
return new Promise((resolve, reject) => {
background.verifySeedPhrase((err) => {
if (err) {
dispatch(displayWarning(err.message));
reject(err);
return;
}
resolve();
});
});
})
.then(() => {
dispatch(hideLoadingIndication());
})

@ -45,17 +45,13 @@ describe('Actions', () => {
sinon.restore();
});
it('calls submitPassword and verifySeedPhrase', async () => {
it('calls submitPassword', async () => {
const store = mockStore();
const submitPassword = background.submitPassword.callsFake((_, cb) =>
cb(),
);
const verifySeedPhrase = background.verifySeedPhrase.callsFake((cb) =>
cb(),
);
actions._setBackgroundConnection(background);
const expectedActions = [
@ -72,7 +68,6 @@ describe('Actions', () => {
await store.dispatch(actions.tryUnlockMetamask());
expect(submitPassword.callCount).toStrictEqual(1);
expect(verifySeedPhrase.callCount).toStrictEqual(1);
expect(store.getActions()).toStrictEqual(expectedActions);
});
@ -97,36 +92,6 @@ describe('Actions', () => {
expect(store.getActions()).toStrictEqual(expectedActions);
});
it('displays warning error and unlock failed when verifySeed fails', async () => {
const store = mockStore();
background.submitPassword.callsFake((_, cb) => cb());
background.verifySeedPhrase.callsFake((cb) => {
cb(new Error('error'));
});
actions._setBackgroundConnection(background);
const expectedActions = [
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
{ type: 'UNLOCK_IN_PROGRESS' },
{ type: 'UNLOCK_SUCCEEDED', value: undefined },
{
type: 'UPDATE_METAMASK_STATE',
value: baseMockState,
},
{ type: 'DISPLAY_WARNING', value: 'error' },
{ type: 'UNLOCK_FAILED', value: 'error' },
{ type: 'HIDE_LOADING_INDICATION' },
];
await expect(
store.dispatch(actions.tryUnlockMetamask('test')),
).rejects.toThrow('error');
expect(store.getActions()).toStrictEqual(expectedActions);
});
});
describe('#createNewVaultAndRestore', () => {

Loading…
Cancel
Save