Skip to content

Instantly share code, notes, and snippets.

@mfix22
Last active March 28, 2017 20:39
Show Gist options
  • Save mfix22/4ee50f1c107be7e59e613724fc8ad949 to your computer and use it in GitHub Desktop.
Save mfix22/4ee50f1c107be7e59e613724fc8ad949 to your computer and use it in GitHub Desktop.
Examples of testing with `gest`
// As a global function
// will create global `gest()` function
Gest(schema)
describe('GraphQL', () => {
// pass a test name and a query
gest('test query', `
{
test
}
`)
})
// Direct instance
const Gest = require('graphicli')
const schema = require('./schema')
const gest = Gest(schema, {
headers: {
Authorization: 'Bearer token',
}
})
describe('GraphQL', () => {
test('{ test }', () => {
return gest('{ test }').then(({ data, errors }) => {
expect(errors).toBeUndefined()
expect(data).toEqual('success!')
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment