React Testing — Timers and Snapshots

John Au-Yeung
Level Up Coding
Published in
3 min readJan 25, 2021

--

Photo by Bogdan Lapadus on Unsplash

Automated tests are important for most apps. In this article, we’ll take a look at how to write tests for React components.

Timers

We can mock timers in our React component tests.

For example, if we have:

import React, { useEffect } from "react";export default function Card({ onSelect }) {…

--

--