-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Edit Post: Refactor listener hook tests to RTL #45066
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
|
Size Change: 0 B Total Size: 1.27 MB ℹ️ View Unchanged
|
tyxla
left a comment
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.
LGTM 👍 Another one bites the dust 🚀
| describe( 'useBlockSelectionListener', () => { | ||
| const registry = createRegistry( mockStores ); | ||
| const TestComponent = ( { postId } ) => { | ||
| useBlockSelectionListener( postId ); |
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.
We could potentially create helpers for those and have them accept props so we don't have to declare almost the same boilerplate code in both tests, but I don't think this will help much. I'm more than happy to keep them as you suggested.
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.
The original test has a similar helper, but I find this more readable, and it only adds a few extra lines.
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.
Agreed 👍
What?
Part of #44780.
This PR refactors the listener hook tests to use
@testing-library/reactinstead ofreact-test-rendererWhy?
It is a part of the recent effort to use
@testing-library/reactas the primary testing library.How?
We're simply rendering with RTL and updating the assertions to be better.
Testing Instructions