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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standard rendering as a catch-all test, thoughts? #561

Closed
mcrowder65 opened this Issue Jan 29, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@mcrowder65
Copy link

mcrowder65 commented Jan 29, 2019

Hey Kent! 馃憢

Just another javascript developer who migrated their entire test suite to react-testing-library from enzyme, and we love it so far.

Just wondering your thoughts on something:

A pattern that I have decided to do is always just render a component without even checking for anything, just to ensure that it renders, this mainly catches things like if file imports broke or if perhaps you're not checking for an undefined variable.

Example:

import React from "react";
import MyComponent from "../my-component";
import { cleanup } from "react-testing-library";
// this is just a wrapped render our react-testing-library render that wraps all of our providers - React intl, material-ui, redux, apollo, etc.
import { render } from "client/../../test/test-utils";

afterEach(cleanup);

test("that it renders without issues", () => {
    render(<MyComponent/>);
});

And this will just be the first line of defense to ensure that we have something that's checking something on the component.

Just wondering what your thoughts are and if this something dumb or not?

Thanks!!!

@kentcdodds

This comment has been minimized.

Copy link
Owner

kentcdodds commented Jan 29, 2019

Hi @mcrowder65!

This is a great question! Here's my answer: https://www.briefs.fm/3-minutes-with-kent/81

@kentcdodds kentcdodds closed this Jan 29, 2019

@mcrowder65

This comment has been minimized.

Copy link
Author

mcrowder65 commented Jan 29, 2019

Thank you Kent! Very useful, +1 to testingjavascript.com, I really enjoyed the react-testing-library section, still need to make my way through the cypress one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment