Skip to content

fix(send-flow-snap): add missing displayAvatar props, add tests, update snaps-simulation #3312

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

Merged
merged 18 commits into from
Apr 15, 2025

Conversation

hmalik88
Copy link
Contributor

@hmalik88 hmalik88 commented Apr 9, 2025

The send-flow example snap is only passing the displayAvatar prop in the to scenario but not in the others. This can land you in a situation where you paste a valid address in the to field, start to type an amount in the amount field, then the avatar disappears because no displayAvatar prop is being passed.

Summary of changes

  • Updated the send flow snap's onUserInput code to properly pass the displayAvatar prop in all scenarios.
  • Added tests for the snap.
  • Added an SVG transformer so jest can handle the icons that are imported in the snap.
  • Updated the structure of the SVGs so it's consistent with what jest expects.
  • Updated typeInField in snaps-simulation so that it properly attaches the chainId to the input value.

@hmalik88 hmalik88 marked this pull request as ready for review April 9, 2025 18:26
@hmalik88 hmalik88 requested a review from a team as a code owner April 9, 2025 18:26
Copy link

codecov bot commented Apr 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.80%. Comparing base (41f8c21) to head (5a6a3ce).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3312   +/-   ##
=======================================
  Coverage   97.79%   97.80%           
=======================================
  Files         363      364    +1     
  Lines        9893     9911   +18     
  Branches     1613     1616    +3     
=======================================
+ Hits         9675     9693   +18     
  Misses        218      218           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor Author

@hmalik88 hmalik88 Apr 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the formatting for this SVG (and the ones below) to a consistent flat format since jest flattens it and the SVG transformer picks up the file content with format.

// Transform SVG files using our custom transformer
transform: {
...baseConfig.transform,
'\\.svg$': '<rootDir>/test/transformers/svgTransformer.js',
Copy link
Contributor Author

@hmalik88 hmalik88 Apr 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed to write a transformer for jest to be able to handle SVGs.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

)+

@hmalik88 hmalik88 changed the title fix: Add missing displayAvatar props fix(send-flow-snap): add missing displayAvatar props, add tests, update snaps-simulation Apr 12, 2025
@hmalik88 hmalik88 requested a review from Mrtenz April 14, 2025 16:07
Mrtenz
Mrtenz previously requested changes Apr 14, 2025
@hmalik88 hmalik88 requested a review from Mrtenz April 14, 2025 16:36
@hmalik88 hmalik88 added this pull request to the merge queue Apr 15, 2025
Merged via the queue into main with commit 8589b4e Apr 15, 2025
165 checks passed
@hmalik88 hmalik88 deleted the hm/add-display-avatar-prop branch April 15, 2025 12:33
Copy link

@mustafacryptolife mustafacryptolife left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants