-
Notifications
You must be signed in to change notification settings - Fork 609
fix: Improve a couple of error messages for UI components #3625
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
Conversation
bd7e15c
to
508d763
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3625 +/- ##
=======================================
Coverage 98.28% 98.28%
=======================================
Files 417 417
Lines 11793 11803 +10
Branches 1841 1844 +3
=======================================
+ Hits 11591 11601 +10
Misses 202 202 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
const result = validate(Text({}), stringUnion); | ||
|
||
expect(result[0]?.message).toBe( | ||
'Expected the value to satisfy a union of `string | union`, but received: [object Object]', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was this message before? This doesn't seem ideal either 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is mostly for coverage purposes, not to actually test the error messages. We want to ensure that typedUnion
doesn't do something unexpected when *entries
is called with a string for example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E.g.
snaps/packages/snaps-sdk/src/internals/structs.ts
Lines 114 to 120 in a8e0d22
if ( | |
!isObject(value) || | |
!hasProperty(value, 'type') || | |
typeof value.type !== 'string' | |
) { | |
return; | |
} |
Improve a couple of error messages when validating UI components that use the
children
utility method.