Chapter 21 Testing with Jest and the React Testing Library

Chapter 21 discussion

Erratta/Recent Change:
You’ll need to also update @testing-library/react to v14.0.0 using npm install --save @testing-library/react@14.0.0 to avoid warnings about things not being wrapped in act(...).

At the end of the chapter there is a section where console.error is mocked. On my machine I had to mock console.log. Even though the error 500 is correctly mocked and returned, it is still dumped using console.log. Any idea why?

Maybe verify your catch in Cart.js is using console.error?

    } catch (error) {
      console.error('Error submitting the order', error);
    }

Bingo, that was it, thanks!

1 Like