Test Driven Development with Jest and React Setup

Setup

In this lesson, we’ll practice writing tests for a prebuilt React application that already has Jest configured. This approach lets us focus on learning how to write tests without spending time on setup.

We’ve provided a starter repository for you to use.

React Jest Testing Applicaiton

1. Fork and Clone

Follow these steps to get your own copy of the starter code:

  1. Sign In: Make sure you’re logged into your GA Enterprise GitHub account.
  2. Fork: Go to the repository link above and fork it into your own GitHub account.
  3. Clone: Copy the SSH or HTTPS URL from your forked repository and run the following command in your terminal:

    git clone <your-forked-repo-url>
    
  4. Navigate into the cloned directory:

    cd <your-forked-repo-folder>
    

2. Install Dependencies

To install all the necessary dependencies for the application, run:

npm install

This command downloads everything needed for the React app to run and for Jest to execute tests.

What’s Next?

Now that the app is set up, you’re ready to explore the starter code. The next section will guide you through the provided files and explain how they fit into the testing process.