Implementing the application headline
Let’s start with the implementation of the pizza store application. If you have cloned the repository mentioned in the Technical requirements section, simply go to the react-anti-patterns-code/src/ch7
folder.
As we’re applying TDD, the first thing to do here is to write a test that fails. In the previous section, we mentioned what we want to test: implement the page title.
So, let’s create a file called App.test.tsx
with the following code:
import React from 'react'; import {render, screen} from '@testing-library/react'; describe('Code Oven Application', () => { it('renders application heading', () => { render(<PizzaShopApp />); const heading = screen.getByText('The Code Oven'); expect(heading).toBeInTheDocument(); }); });
We’re writing a test for the...