Skip to content

Instantly share code, notes, and snippets.

@stubailo
Created November 26, 2018 17:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stubailo/51dc130cf5e1e9e684a24a80b158540f to your computer and use it in GitHub Desktop.
Save stubailo/51dc130cf5e1e9e684a24a80b158540f to your computer and use it in GitHub Desktop.
How we use a mocking provider to mock data
import TodoList from './TodoList';
// Specify some resolvers for this instance
const customResolvers = {
Query: () => ({
todoItems: [
{ completed: true },
{ completed: false },
]
})
};
// TodoList uses the following query:
// query {
// todoItems {
// text
// completed
// owner { name }
// }
// }
<ApolloMockingProvider customResolvers={customResolvers}>
<TodoList />
</ApolloMockingProvider>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment