December 2019
Intermediate to advanced
598 pages
12h 21m
English
Carry out the following steps to test that the Page component renders correctly:
import React from 'react';import { render, cleanup } from '@testing-library/react';import { Page } from './Page';test('When the Page component is rendered, it should contain the correct title and content', () => { });
We imported React with our Page component, along with some useful functions from the React Testing Library.
The React Testing Library was installed by Create React App when we created the frontend project. This library will help us select elements that we want to check without using internal implementation details such as element IDs or CSS ...
Read now
Unlock full access