Last active
March 28, 2017 20:39
-
-
Save mfix22/4ee50f1c107be7e59e613724fc8ad949 to your computer and use it in GitHub Desktop.
Examples of testing with `gest`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// As a global function | |
// will create global `gest()` function | |
Gest(schema) | |
describe('GraphQL', () => { | |
// pass a test name and a query | |
gest('test query', ` | |
{ | |
test | |
} | |
`) | |
}) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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