Skip to content

Commit

Permalink
improve test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
panleone committed Dec 7, 2023
1 parent bd9f052 commit 3a5279b
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/components/AccessWallet.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,35 @@ describe('access wallet tests', () => {
expect(wrapper.emitted('import-wallet')).toStrictEqual([
['dog pig', 'myPass'],
]);

// Round 2, this time the user wants to insert his private key
// but the user by mistake begins inserting the seedphrase
secretInp.element.value = 'dog pig';
secretInp.trigger('input');
await nextTick();
expect(secretInp.attributes('type')).toBe('text');
expect(passwordInp.isVisible()).toBeTruthy();
passwordInp.element.value = 'myPass';
passwordInp.trigger('input');
await nextTick();

// Oops I inserted the bip39! let me change
secretInp.element.value = 'xprivkey';
secretInp.trigger('input');
await nextTick();
expect(secretInp.attributes('type')).toBe('password');
// Password field must be cleared and invisible
expect(passwordInp.isVisible()).toBeFalsy();
expect(passwordInp.element.value).toBe('');
await nextTick();

await importWalletButton.trigger('click');
expect(secretInp.element.value).toBe('');
expect(passwordInp.element.value).toBe('');
expect(wrapper.emitted('import-wallet')).toHaveLength(2);
expect(wrapper.emitted('import-wallet')[1]).toStrictEqual([
'xprivkey',
'',
]);
});
});

0 comments on commit 3a5279b

Please sign in to comment.