r/learnwebdev • • Feb 07 '21

A guide to unit testing React + Apollo GraphQL components

I wrote a step-by-step guide for mocking and testing React Apollo components using a component on our website as an example.

It includes:

  • Setting up Jest
  • Mocking Apollo GraphQL queries and mutations
  • Writing tests using MockedProvider and mocks
  • Solutions to common errors

Check it out here: https://www.dolthub.com/blog/2021-02-05-guide-to-react-unit-testing/

5 Upvotes

0 comments sorted by