Four artefacts come out of the same field list: the SDL type, a query that selects it, a mutation that creates it, and a response payload shaped to match. They stay consistent with each other, which hand-written mocks rarely do.
What you can control
- SDL output includes the input type and the query and mutation fields, not just the object type.
- Relay mode adds the full connection shape — edges, nodes, cursors and
pageInfo. - Query and mutation documents come with a matching variables block.
- Nullability follows the field:
idis non-null, an optional string is not.
Testing ideas
- Schema first. Generate the SDL, paste it into a mock server such as GraphQL Yoga or Apollo Server with mocks enabled, and point your client at it.
- Relay connections. Turn on Relay-style connections to test
edges,pageInfo.hasNextPageand cursor handling in your pagination hook. - Variables. Use the generated query or mutation with its variables block to test your client's variable handling.
- Response payloads. Feed the response payload to component tests so they do not depend on a running server.
What this is not
Cursors are base64-encoded index strings rather than opaque server tokens. They are the right shape for testing a client, not for a server implementation.