- Test resolvers in isolation by calling them directly with mocked context and dataloaders — do not go through the full HTTP stack for unit tests.
- Use `graphql-tag` (`gql`) template literals for test query documents to get syntax highlighting and parse-time validation.
- Validate schema against a stored snapshot with `printSchema()` and a snapshot test — catch accidental breaking changes before they ship.
- Use `@apollo/server` `executeOperation` method for integration tests — it runs through the full resolver pipeline without an HTTP server.
- Group tests by type and feature: `Query.user.test.ts`, `Mutation.createPost.test.ts` — mirror your resolver file structure.
- Test pagination cursors explicitly: verify `hasNextPage`, `hasPreviousPage`, `startCursor`, and `endCursor` for every paginated field.
- Use factory functions to build test `context` objects with seeded authentication and dataloader instances for consistent test setup.