0.3.5 • Published 6 years ago

apollo-test-utils-with-context v0.3.5

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

apollo-test-utils

Greenkeeper badge

This is a very rudimentary package that currently only exports functions for mocking an Apollo Client network interface. Here's an example for how to use it:

  import ApolloClient from 'apollo-client';
  import gql from 'graphql-tag';
  import { makeExecutableSchema, addMockFunctionsToSchema } from 'graphql-tools';
  import { mockNetworkInterfaceWithSchema } from 'apollo-test-utils';

  const typeDefs = `
      type User {
        id: Int
        name: String
      }

      type Query {
        user: User
      }
    `;

  const schema = makeExecutableSchema({ typeDefs });
  addMockFunctionsToSchema({ schema });

  const mockNetworkInterface = mockNetworkInterfaceWithSchema({ schema });

  const client = new ApolloClient({
    networkInterface: mockNetworkInterface,
  });

  client.query({
    query: gql`{ user { name } }`,
  });
0.3.5

6 years ago

0.3.4

6 years ago

0.3.2

6 years ago