Page MenuHomePhabricator

[Cashtab] Migrate validateMnemonic from useWallet to validation
ClosedPublic

Authored by emack on Nov 22 2022, 22:52.

Details

Summary

T2800

This diff:

  • moves the validateMnemonic function from useWallet to validation
  • adds corresponding unit tests to validate.test.js
  • updates references to validateMnemonic in the Onboarding and Configure components
Test Plan
  • grep -r 'validateMnemonic' src/ and ensure no references to useWallet's ContextValue object
  • npm test
  • npm start
  • create a new wallet, note the mnemonic, delete wallet
  • import the wallet via mnemonic
  • ensure successful send and receive of XEC to this imported wallet
  • open browser in incognito mode to trigger onboarding screen
  • create a new wallet and ensure successful creation
  • import the earlier wallet via mnemonic
  • ensure successful send and receive of XEC to this imported wallet

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

emack requested review of this revision.Nov 22 2022, 22:52
bytesofman added inline comments.
web/cashtab/src/utils/__tests__/validation.test.js
52 ↗(On Diff #36530)

Since the wordlist is already set as the default param within the function definition of validateMnemonic(), should be able to remove it here and call these functions in the unit test with just validateMnemonic(mnemonic)

This revision is now accepted and ready to land.Nov 23 2022, 08:19
emack marked an inline comment as done.

removed redundant bip39 wordlist in unit tests

This revision was landed with ongoing or failed builds.Nov 23 2022, 09:09
This revision was automatically updated to reflect the committed changes.