Mocking and automocking for tests and storybooks
summary
GraphQL mocks move from per-query JSON blobs to a reusable schema-driven approach using addMockFunctionsToSchema and graphql-tools; an auto-mocked provider is built and plugged into Storybook and tests, generating realistic objects so only types need maintenance instead of every query. It returns defaults like hello world and shows 137 total results in the demo; caveats: non‑deterministic random data, poor time-series fidelity, and need to seed faker/math.random for stable snapshots.
AI-written summary · about
chapters (6)
- 0:00Start
- 3:28importing the curry from the component
- 4:42add a new field to the initial query
- 10:32passing in some resolvers
- 13:58add a resolver for the category
- 20:55tweak the coordinates
related talks
25mSophisticated Schema Mocking
22mA Mock Is a Promise: Making GraphQL Mocks Enforceable
16mHow I Started Mocking My GraphQL Schema
34mSchema-Driven Testing with Mock Service Worker
38mDeterministic Mocking with GraphQL and Apollo Lunar Launch
30mIncrease Your Productivity With No Code GraphQL Mocking
33mGraphQL mocking and why it is important for developer productivity.
28mTo mock, or not to mock?
