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

Expand testing for expanded-view notifications #2956

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

hmalik88
Copy link
Contributor

@hmalik88 hmalik88 commented Dec 14, 2024

  1. Updated the @metamask/notification-example-snap to have a method to trigger an expanded view notification.
  2. Updated test-snaps to trigger the new methods added above.
  3. Updated snaps-jest to allow for unit testing of expanded view notifications.

Copy link

codecov bot commented Dec 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.73%. Comparing base (3e615f5) to head (8a4f74a).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2956      +/-   ##
==========================================
+ Coverage   94.71%   94.73%   +0.01%     
==========================================
  Files         497      497              
  Lines       10802    10843      +41     
  Branches     1649     1662      +13     
==========================================
+ Hits        10231    10272      +41     
  Misses        571      571              

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

@hmalik88 hmalik88 changed the title Update notification example snap Expand testing for expanded-view notifications Dec 17, 2024
@hmalik88 hmalik88 marked this pull request as ready for review December 17, 2024 22:21
@hmalik88 hmalik88 requested a review from a team as a code owner December 17, 2024 22:21
`Expected footer link: ${this.utils.printExpected(
expectedFooterLink,
)}\n` +
`Expected content id type: ${this.utils.printExpected('String')}\n` +
Copy link
Member

Choose a reason for hiding this comment

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

What's this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Realized that the notify method is creating an interface (expanded view) but not exposing the interface id, so the id can't be used inside toSendNotification. I was attempting to do some validation to make sure the response had a string content id. I'm now wondering if I can somehow intercept the middleware to return the original jsx content instead of the interface id so users can also validate the content inside of toSendNotification

Copy link
Contributor Author

@hmalik88 hmalik88 Dec 18, 2024

Choose a reason for hiding this comment

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

@Mrtenz In the latest commit, 2cb571f, I'm trying to get the actual jsx content now and match against it, returning the jsx content in the "received" part of the message. The example snap's test pass regardless if I have the wrong content passed into toSendNotification so I'm not sure where I'm going wrong here, would appreciate a second look.

Copy link
Contributor Author

@hmalik88 hmalik88 Dec 19, 2024

Choose a reason for hiding this comment

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

Nevermind, figured it out :)

@hmalik88 hmalik88 marked this pull request as draft December 18, 2024 22:15
@hmalik88 hmalik88 marked this pull request as ready for review December 23, 2024 20:40
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.

3 participants