/refresh-testing-workshop

Testing workshop in JS and React @ Refresh conference

Primary LanguageJavaScriptMIT LicenseMIT

🔍 Introduction to testing JavaScript and React

This a workshop that covers the basics of testing JavaScript and React at Refresh conference.

💻 System requirements

  • node 16 || 18
  • npm v8.16.0 or greater

To verify whether you have correct versions, run:

node --version
npm --version

🌱 Setup

I recommend setup this project before the workshop, so that you would have everything ready before we start.

Just follow these instructions:

  1. Clone this repo
  2. Install dependencies npm install
  3. Start dev server with playground npm start, check on http://localhost:3000/ that application runs correctly

🗂 Navigate

In this repo inside /src folder you will find folders representing each part of the workshop.

Workshop is divided into 3 main parts:

  • Part 1: what is testing, fundamentals, introduction to Jest
  • Part 2: introduction to testing React components, testing-library, react-testing-library
  • Part 3: testing async code, mocking API, how to apply what we learned to testing React apps

💡 Tasks

During this 3-hour workshop you will do 3 practiocal tasks on your own:

  1. Fundamentals of testing to practice writing tests for pure JS functions
  2. Testing React components to practice testing simple React components
  3. Testing React components with async to practice writing tests for components that use async API

In files of tasks you will find instructions and hints in code comments. Each task also has the solution defined, it is within the __solution__ folder. This folder is skipped during the test runs, but you are welcome to check out the code if you feel stuck.

📚 Resources

Here are some additional resources I recommend looking into afterwards

💭 Feedback

I would really appreciate your anonymous feedback about the workshop!

👉 Share feedback