The pyramid above describes the three types of tests in the Product Catalog fronted.
Unit Tests
Purpose: Function testing or Rendering of a single component
Tool: jest + react testing library
Mock everything except the unit being tested
Integration
Purpose: Verify several units working together
Tool: jest + react testing library
Mock as little as possible. Only mock:
Network requests (API calls)
Animation components (so that tests don’t need to wait
E2E
Purpose: Verify that the entire system functions correctly
Tool: cypress
Mock nothing
Run against the entire application setup (backend + frontend)
Backend can be spinned up using Docker with a test data set