Unverified Commit f4c5f325 authored by Valentine Wallace's avatar Valentine Wallace Committed by Tankred Hase

Adapt the checkNewPassword helper for wallet restore case.

Since we use the  flow during wallet recovery now, we need to change checkNewPassword to detect whether we're
doing a wallet recovery, and initialize the wallet accordingly.
parent a91eea4c
......@@ -212,7 +212,10 @@ class WalletAction {
}
await this.initWallet({
walletPassword: newPassword,
seedMnemonic: this._store.seedMnemonic.toJSON(),
recoveryWindow: this._store.settings.restoring ? RECOVERY_WINDOW : 0,
seedMnemonic: this._store.settings.restoring
? this._store.wallet.restoreSeed.toJSON()
: this._store.seedMnemonic.toJSON(),
});
}
......
......@@ -214,6 +214,7 @@ describe('Action Wallet Unit Tests', () => {
expect(wallet.initWallet, 'was called with', {
walletPassword: 'secret123',
seedMnemonic: ['foo', 'bar', 'baz'],
recoveryWindow: 0,
});
});
......@@ -234,6 +235,19 @@ describe('Action Wallet Unit Tests', () => {
expect(wallet.initSetPassword, 'was called once');
expect(notification.display, 'was called once');
});
it('init wallet correctly during restore', async () => {
store.settings.restoring = true;
wallet.setNewPassword({ password: 'secret123' });
wallet.setPasswordVerify({ password: 'secret123' });
store.wallet.restoreSeed = ['beep', 'bop', 'boop'];
await wallet.checkNewPassword();
expect(wallet.initWallet, 'was called with', {
walletPassword: 'secret123',
seedMnemonic: ['beep', 'bop', 'boop'],
recoveryWindow: RECOVERY_WINDOW,
});
});
});
describe('checkResetPassword()', () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment