Schema-Driven Testing with Mock Service Worker
summary
Demonstrates a concrete setup that replaces brittle static response mocks with a schema-driven handler that uses graphql-tools executors plus MSW v2 to intercept real fetches in browser and Node via setupServer the handler generates incremental multipart responses for @defer/@stream, returns random scalars unless overridden, and exposes a withResolvers API to layer test-specific data in individual tests storybook, Jest, Puppeteer and Cypress all use the same handlers and websocket preview (createWebSocketHandler) is nearly ready.
AI-written summary · about
chapters (8)
- 0:00Introduction and context
- 2:28Recap of testing pain points
- 5:07Defining the testing wishlist
- 7:11Schema-based mocking strategies
- 11:38Introducing mock service worker
- 15:38GraphQL testing library in action
- 23:31Subscription and future support
- 26:33Closing and Q&A
related talks
22mMocking and automocking for tests and storybooks
25mSophisticated Schema Mocking
30mAll you need is a contract
38mDeterministic Mocking with GraphQL and Apollo Lunar Launch
25mMock to start
22mA Mock Is a Promise: Making GraphQL Mocks Enforceable
40mStrategic Business Functionality Testing: Accelerating Development Through Mocking
33mGraphQL mocking and why it is important for developer productivity.
