Making our tests pass again

Since we've changed a bunch of input and button tags and we have tests that are specifically looking for them, we'll need to hop into src/NewTodo/NewTodo.test.js first, and change every instance of .find("input") and .find("button") to .find("Input"), and .find("Button"). We'll start with our first test, which tests the form:

  it("contains the form", () => {    expect(component.find("Input")).toHaveLength(1);    expect(component.find("Button")).toHaveLength(1);  });

We'll also want to modify the next test that relies on simulating button clicks:

  it("calls the passed in addTodo function when add button is clicked", () => {    component.find("Button").simulate("click");    expect(mockAddTodo).toBeCalled();  });

We're almost done ...

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.