I am completely new to testing react applications. I am wondering is there a need for testing that every component renders without crashing, or does just testing the App component suffice as it is the parent of all components?
Also, any tip and what to test for in a component would be great :)
import { render } from "@testing-library/react";
import App from "./App";
// Test that the App Component renders without crashing
describe("App", () => {
test("renders App component", () => {
render(<App />);
});
});
For example, in another component would I do the following test:
import { render } from "@testing-library/react";
import App from "./App";
// Test that the AnotherComp Component renders without crashing
describe("AnotherComp", () => {
test("renders App component", () => {
render(<AnotherComp/>);
});
});