Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test case for failing parsing #1166

Merged
merged 2 commits into from
Dec 20, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/language/__tests__/schema-parser-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,38 @@ extend type Hello {
expect(printJson(doc)).to.equal(printJson(expected));
});

it('Extension without fields followed by extension', () => {
const body = `
extend type Hello implements Greeting

extend type Hello implements SecondGreeting
`;
const doc = parse(body);
const expected = {
kind: 'Document',
definitions: [
{
kind: 'ObjectTypeExtension',
name: nameNode('Hello', { start: 19, end: 24 }),
interfaces: [typeNode('Greeting', { start: 36, end: 44 })],
directives: [],
fields: [],
loc: { start: 7, end: 44 },
},
{
kind: 'ObjectTypeExtension',
name: nameNode('Hello', { start: 64, end: 69 }),
interfaces: [typeNode('SecondGreeting', { start: 81, end: 95 })],
directives: [],
fields: [],
loc: { start: 52, end: 95 },
},
],
loc: { start: 0, end: 100 },
};
expect(printJson(doc)).to.equal(printJson(expected));
});

it('Extension without anything throws', () => {
expectSyntaxError('extend type Hello', 'Unexpected <EOF>', {
line: 1,
Expand Down