-
Notifications
You must be signed in to change notification settings - Fork 288
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
Setup react-testing-library and some clean up #686
Conversation
Signed-off-by: Will Lopez <[email protected]>
Signed-off-by: Will Lopez <[email protected]>
Signed-off-by: Will Lopez <[email protected]>
Signed-off-by: Will Lopez <[email protected]>
Signed-off-by: Will Lopez <[email protected]>
Signed-off-by: Will Lopez <[email protected]>
components/Footer/Footer.test.js
Outdated
import Footer from "./Footer"; | ||
|
||
test("Renders the footer", () => { | ||
const { getByText } = render(<Footer />); |
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.
You should import screen
then use screen.getByText
instead. This is now the recommended way to use react-testing rather than de-structuring utils from the render func. Most of the utils you're used to using are available on screen
.
import { render, screen } from "@testing-library/react";
render(<Footer />);
screen.getByText(TEXT);
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.
refactored.
Signed-off-by: Will Lopez <[email protected]>
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.
👍
Impact: minor
Type: refactor
Issue
There were a couple of unnecessary dependencies related to testing.
Solution
Removed unnecessary dependencies and added
react-testing-library
as the preferred testing library. Also, a sample test was adde for theFooter
component. This is a stepping stone in the general testing direction described in #683Breaking changes
Any tests that used enzyme will no longer work.
Testing