Adding tests for TodoList

We'll start off by adding a framework to put the rest of our TodoList tests on! We'll need our standard imports and tests for rendering, snapshots, and shallow components! We'll start off with this scaffold for src/TodoList.test.js:

import React from "react";import ReactDOM from "react-dom";import { shallow } from "enzyme";import renderer from "react-test-renderer";import TodoList from "./TodoList";import NewTodo from "./NewTodo";import Todo from "./Todo";describe(TodoList, () => {  const component = shallow(<TodoList />);  it("renders without crashing", () => {    const div = document.createElement("div");    ReactDOM.render(<TodoList />, div);    ReactDOM.unmountComponentAtNode(div);  }); it("renders and matches our snapshot", ...

Get Create React App 2 Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.