@shopify/jest-mock-apollo
Jest + Enzyme mocks for Apollo 2.x.
Last updated 24 days ago by shopify-dep .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @shopify/jest-mock-apollo 
SYNC missed versions from official npm registry.

@shopify/jest-mock-apollo

Build Status License: MIT npm version

:warning: This is being replace with @shopify/graphql-testing

Jest + Enzyme mocks for Apollo 2.x.

Installation

$ yarn add @shopify/jest-mock-apollo

Setup

This package provides a decorator for building mock GraphQL clients specific to your project. The initial function call takes in project-wide configuration and emits a customized decorator to be used across your project. For example:

// tests/utilities/graphql.ts
import {buildSchema} from 'graphql';
import configureClient from '@shopify/jest-mock-apollo';

// You likely want to import this from somewhere in real production code
const schemaSrc = `
  type Product {
    id: Int!
    title: String
  }

  type Query {
    products: [Product]
  }
`;
const schema = buildSchema(schemaSrc);

const createGraphQLClient = configureClient({schema});

export {createGraphQLClient};

The factory requires a GraphQLSchema (schema) in order to ensure that more useful error messages are shown and that mocks are validated against the schema.

Example Usage

Take a look at the test suite for examples on how to use enzyme's mock context.

API Reference

See the comments and TypeScript annotations in the code for details on the provided utilities.

Current Tags

  • 4.0.3                                ...           latest (24 days ago)

35 Versions

  • 4.0.3                                ...           24 days ago
  • 4.0.2                                ...           a month ago
  • 4.0.1                                ...           a month ago
  • 4.0.0                                ...           2 months ago
  • 3.1.6                                ...           2 months ago
  • 3.1.5                                ...           2 months ago
  • 3.1.4                                ...           3 months ago
  • 3.1.3                                ...           4 months ago
  • 3.1.2                                ...           4 months ago
  • 3.1.1                                ...           6 months ago
  • 3.0.6                                ...           8 months ago
  • 3.0.5                                ...           8 months ago
  • 3.0.4                                ...           8 months ago
  • 3.0.3                                ...           8 months ago
  • 3.0.2                                ...           8 months ago
  • 3.0.1                                ...           9 months ago
  • 3.0.0                                ...           9 months ago
  • 2.2.8                                ...           10 months ago
  • 2.2.7                                ...           10 months ago
  • 2.2.6                                ...           10 months ago
  • 2.2.5                                ...           a year ago
  • 2.2.3                                ...           a year ago
  • 2.2.2                                ...           a year ago
  • 2.2.1                                ...           a year ago
  • 2.2.0                                ...           a year ago
  • 2.1.3                                ...           a year ago
  • 2.1.2                                ...           a year ago
  • 2.1.1                                ...           a year ago
  • 2.1.0                                ...           a year ago
  • 2.0.1                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
  • 1.0.8                                ...           2 years ago
  • 1.0.7                                ...           2 years ago
  • 1.0.6                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Downloads
Today 0
This Week 70
This Month 70
Last Day 0
Last Week 0
Last Month 81
Dependencies (4)
Dev Dependencies (5)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |