Skip to content

Commit 674e3c7

Browse files
freiksenetleebyron
authored andcommitted
Add test case for failing parsing (#1166)
* Add test case for failing parsing * Update expected token locations
1 parent c496fb7 commit 674e3c7

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

src/language/__tests__/schema-parser-test.js

+32
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,38 @@ extend type Hello {
203203
expect(printJson(doc)).to.equal(printJson(expected));
204204
});
205205

206+
it('Extension without fields followed by extension', () => {
207+
const body = `
208+
extend type Hello implements Greeting
209+
210+
extend type Hello implements SecondGreeting
211+
`;
212+
const doc = parse(body);
213+
const expected = {
214+
kind: 'Document',
215+
definitions: [
216+
{
217+
kind: 'ObjectTypeExtension',
218+
name: nameNode('Hello', { start: 19, end: 24 }),
219+
interfaces: [typeNode('Greeting', { start: 36, end: 44 })],
220+
directives: [],
221+
fields: [],
222+
loc: { start: 7, end: 44 },
223+
},
224+
{
225+
kind: 'ObjectTypeExtension',
226+
name: nameNode('Hello', { start: 64, end: 69 }),
227+
interfaces: [typeNode('SecondGreeting', { start: 81, end: 95 })],
228+
directives: [],
229+
fields: [],
230+
loc: { start: 52, end: 95 },
231+
},
232+
],
233+
loc: { start: 0, end: 100 },
234+
};
235+
expect(printJson(doc)).to.equal(printJson(expected));
236+
});
237+
206238
it('Extension without anything throws', () => {
207239
expectSyntaxError('extend type Hello', 'Unexpected <EOF>', {
208240
line: 1,

0 commit comments

Comments
 (0)