Skip to content

Instantly share code, notes, and snippets.

@helfer
Last active March 11, 2020 21:18
Show Gist options
  • Save helfer/586e32a2852059cc5e7d6889ea771ed1 to your computer and use it in GitHub Desktop.
Save helfer/586e32a2852059cc5e7d6889ea771ed1 to your computer and use it in GitHub Desktop.
// > npm install graphql-tools
import { mockServer } from 'graphql-tools';
import schema from './mySchema.graphql';
const myMockServer = mockServer(schema);
myMockServer.query(`{
allUsers: {
id
name
}
}`);
// returns
// {
// data: {
// allUsers:[
// { id: 'ee5ae76d-9b91-4270-a007-fad2054e2e75', name: 'lorem ipsum' },
// { id: 'ca5c182b-99a8-4391-b4b4-4a20bd7cb13a', name: 'quis ut' }
// ]
// }
// }
@yagotome
Copy link

It seems there's a typo on line 8. Wouldn't it be allUsers { (without the colon)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment