Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Handle special characters for prefix in address input #4287

Merged
merged 1 commit into from
Oct 4, 2024

Conversation

usame-algan
Copy link
Member

@usame-algan usame-algan commented Sep 30, 2024

What it solves

Noticed that the AddressInput unit test randomly fails sometimes. This happens when faker generates a shortName with a hyphen or other special characters in it so I adjusted our cleanup function to handle such characters.

How this PR fixes it

  • Updates cleanInputValue to not only handle a-z0-9 characters in the prefix but any character that is not a :
  • Adds unit tests for cleanInputValue

How to test it

  1. Create a send transaction
  2. Input test-prefix:<some address> into the recipient field
  3. Observe that the value is not changed
  4. Input a real chain prefix like eth:<some address>
  5. Observe that it is the same behaviour as previously

Screenshots

On prod when typing test-hyphen:<some address>
Screenshot 2024-09-30 at 16 44 36

With the change when typing test-hyphen:<some address>
Screenshot 2024-09-30 at 16 44 23

Checklist

  • I've tested the branch on mobile 📱
  • I've documented how it affects the analytics (if at all) 📊
  • I've written a unit/e2e test for it (if applicable) 🧑‍💻

Copy link

github-actions bot commented Sep 30, 2024

Copy link

📦 Next.js Bundle Analysis for safe-wallet-web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

Copy link

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
78.09% (-0% 🔻)
11999/15365
🔴 Branches
58.21% (+0.04% 🔼)
3084/5298
🟡 Functions 65.09% 1889/2902
🟡 Lines
79.63% (-0% 🔻)
10830/13600

Test suite run success

1497 tests passing in 203 suites.

Report generated by 🧪jest coverage report action from 2a65e52

@francovenica
Copy link
Contributor

Never thought about entering a network with a special character. LGTM

@usame-algan usame-algan merged commit 5db2132 into dev Oct 4, 2024
14 of 15 checks passed
@usame-algan usame-algan deleted the fix-address-input-test branch October 4, 2024 07:53
@github-actions github-actions bot locked and limited conversation to collaborators Oct 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants