apollographql / apollo-link

:link: Interface for fetching and modifying control flow of GraphQL requests
https://www.apollographql.com/docs/link/
MIT License
1.44k stars 344 forks source link

Add mock examples to apollo-link-schema README #535

Open anthonator opened 6 years ago

anthonator commented 6 years ago

It would be good to have some examples of mocking for apollo-link-schema. Currently, the mock examples aren't very helpful:

const mocks = {
  Query: () => ...,
  Mutation: () => ...
};

It would also be good to have some different mock scenarios. For example, mocks that demonstrate:

I'm assuming that mocks are expected to be functions that either return a payload or throw an ApolloError. Others may need some more guidance.

evans commented 6 years ago

I totally agree that would be great! I added some more documentation around mocking. #363 adds a little and points at the graphql-tools mocking functions. Could you take a look and see what should be added there?

/label docs