-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 getPxFromCssUnit test stability and test that memoized function works correctly #35939
Conversation
Size Change: +1.83 kB (0%) Total Size: 1.07 MB
ℹ️ View Unchanged
|
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.
Nice, thank for working on the follow up changes 👍🏻
{ unit: '40Q', expected: '38px' }, // 40 Q should be 1 cm | ||
]; | ||
|
||
testData.forEach( ( data ) => { |
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.
Jest also offers a useful helper functions describe.each
and test.each
that are sometimes good fit in cases like the one here.
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.
Thanks, I didn't know those existed! I will update the tests with those changes.
Description
This Pr updates the getPxFromCssUnit test to include testing the memoized function and makes sure that the cached version returns the same result as the memoized function.
Run the tests locally.
Related https://github.com/WordPress/gutenberg/pull/35205/files#r734296446
Types of changes
Do the tests pass?
Checklist:
*.native.js
files for terms that need renaming or removal).