Skip to content
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

Merged
merged 7 commits into from
Jun 17, 2020
Merged

Conversation

willopez
Copy link
Member

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 the Footer component. This is a stepping stone in the general testing direction described in #683

Breaking changes

Any tests that used enzyme will no longer work.

Testing

  1. App start and run without issues
  2. All tests should pass.

import Footer from "./Footer";

test("Renders the footer", () => {
const { getByText } = render(<Footer />);
Copy link
Member

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);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refactored.

Copy link
Member

@mikemurray mikemurray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@mikemurray mikemurray merged commit b328032 into trunk Jun 17, 2020
@mikemurray mikemurray deleted the setup-new-testing branch June 17, 2020 00:00
@willopez willopez mentioned this pull request Jun 17, 2020
@kieckhafer kieckhafer mentioned this pull request Sep 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants