The queryBy Variant
Explore how to use the queryBy variant in React Testing Library to confirm elements are not present in the DOM and apply findBy to handle asynchronous element appearance. Understand how to refactor tests for user interface changes and verify correct rendering behaviors in React apps.
We'll cover the following...
We'll cover the following...
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 ...