Testing
Apollo Client Testing: Mocking Queries, Mutations, and Cache
Apollo Client is the most widely used GraphQL client for React, and testing it properly means going beyond shallow component tests.
Testing
Apollo Client is the most widely used GraphQL client for React, and testing it properly means going beyond shallow component tests.
Testing
urql is a lightweight, extensible GraphQL client for React that uses an exchange-based architecture.
Testing
Relay Modern is Facebook's production GraphQL client, built for performance and type safety.
Testing
When testing GraphQL client code, you have multiple layers where you can inject mocks: at the network level (MSW), at the schema level (graphql-tools), at the client level (Apollo MockedProvider, urql exchanges), or at the component level. Each approach has tradeoffs. This guide compares them and shows when to
Testing
Apollo Client's hook API (useQuery, useMutation, useLazyQuery, useSubscription) is how most React apps interact with GraphQL today.
Testing
E2E testing for GraphQL-powered apps requires different techniques than REST APIs. With REST, you intercept by URL (/api/users).
Testing
Apollo Server's executeOperation is excellent for most GraphQL testing.
Testing
Apollo Server is the most popular GraphQL server for Node.js. Its testing story is surprisingly good: executeOperation lets you run queries against an in-memory server without HTTP overhead, making integration tests fast and deterministic. This guide focuses on the practical patterns you need for testing Apollo Server 4
Testing
Testing GraphQL APIs is fundamentally different from testing REST. With REST, each endpoint has a specific contract.
Testing
GraphQL schema evolution is a double-edged sword. The schema gives you a formal contract between clients and servers.
Testing
GraphQL APIs break most REST testing assumptions. One endpoint, unlimited query shapes, typed schemas, subscriptions — it's a different beast.