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: properly handle invalid interfaces during test #2433

Merged
merged 4 commits into from
May 28, 2024

Conversation

FrederikBolding
Copy link
Member

When using .getInterface() with a Snap that produces an invalid interface, the tests would previously time out. This PR aims to catch the problem and fail sooner with a better error message.

@FrederikBolding FrederikBolding force-pushed the fb/fix-test-timeout-with-invalid-jsx branch from 2a06327 to fffea18 Compare May 28, 2024 12:11
@FrederikBolding FrederikBolding changed the title fix: properly handle invalid interfaces when testing dialogs fix: properly handle invalid interfaces during test May 28, 2024
@FrederikBolding FrederikBolding marked this pull request as ready for review May 28, 2024 12:12
@FrederikBolding FrederikBolding requested a review from a team as a code owner May 28, 2024 12:12
@@ -60,6 +72,12 @@ export function handleRequest({
runSaga,
request: { id = nanoid(), origin = 'https://metamask.io', ...options },
}: HandleRequestOptions): SnapRequest {
const getInterfaceError = () => {
throw new Error(
'Unable to get the interface from the Snap: The returned interface may be invalid.',
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if this error makes sense if the entire request failed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Unable to get the interface from the Snap: The request to the Snap failed. ?

Copy link
Member

Choose a reason for hiding this comment

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

👍

Copy link

codecov bot commented May 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.32%. Comparing base (6bd631e) to head (7537ea6).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2433   +/-   ##
=======================================
  Coverage   94.31%   94.32%           
=======================================
  Files         438      438           
  Lines        9001     9016   +15     
  Branches     1379     1382    +3     
=======================================
+ Hits         8489     8504   +15     
  Misses        512      512           

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

@FrederikBolding FrederikBolding merged commit 963bb5e into main May 28, 2024
153 checks passed
@FrederikBolding FrederikBolding deleted the fb/fix-test-timeout-with-invalid-jsx branch May 28, 2024 12:26
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.

2 participants