-
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
Editor: Refactor PostPreviewButton
tests to @testing-library/react
#44470
Conversation
Size Change: 0 B Total Size: 1.26 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.
All previous test cases seem covered, thank you! Great work
|
||
expect( setter ).not.toHaveBeenCalled(); |
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.
Not sure I understand how these tests used to work — setter
is never assigned / passed to PostPreviewButton
?
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.
They just never really worked 😅
packages/editor/src/components/post-preview-button/test/index.js
Outdated
Show resolved
Hide resolved
packages/editor/src/components/post-preview-button/test/index.js
Outdated
Show resolved
Hide resolved
Co-authored-by: Marco Ciampini <marco.ciampo@gmail.com>
Co-authored-by: Marco Ciampini <marco.ciampo@gmail.com>
What?
We've recently started refactoring
enzyme
tests to@testing-library/react
.This PR refactors the
IsolatedEventContainer
tests fromenzyme
to@testing-library/react
.One of the last remaining bits of #17249.
Why?
@testing-library/react
provides a better way to write tests for accessible components that is closer to the way the user experiences them.How?
We're refactoring the tests a bit to test more the from the user perspective and less from the implementation detail perspective.
Testing Instructions
Verify tests pass:
npm run test:unit packages/editor/src/components/post-preview-button/test/index.js