The queryBy Variant

Learn about the queryBy query variant in this lesson.

Starter project

The starter project for this lesson is a similar project to the projects we worked on in previous lessons. The project contains the following test:

test("Should not initially render person name", () => {
  render(<PersonPage id={0} />);
  expect(screen.getByText("Herman Vandervort")).not.toBeInTheDocument();
});

The test checks that the person’s name isn’t rendered straight away.

A copy of the project is in the code widget below. The “Run” button automatically runs the tests.

Get hands-on with 1400+ tech skills courses.