Search⌘ K
AI Features

Exercise: RTL Queries

Complete hands-on exercises to implement and verify React Testing Library queries for a table component using Jest. Learn to test column headings, cell content, and text alignment to ensure your UI renders as expected.

We'll cover the following...

Starter project

The project contains a Table component in the Table.js file in the src/Table folder. The component renders an HTML table containing data we provide in a prop.

Run the app by executing the following command in a terminal:

npm start
export default "test-file-stub";
Rendering an HTML table

We will see an example of the Table component on the page that appears:

The project also contains half-implemented tests for the Table component in a file called Table.test.js. In this exercise, we’ll finish the implementation of all the tests.

The half-implemented project is given ...