Skip to content

Commit

Permalink
Add test for parsing extend type definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
swolchok committed Sep 12, 2015
1 parent e556526 commit 9ffe3c7
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/language/__tests__/schema-parser.js
Expand Up @@ -104,6 +104,39 @@ type Hello {
expect(printJson(doc)).to.equal(printJson(expected));
});

it('Simple extension', () => {
var body = `
extend type Hello {
world: String
}`;
var doc = parse(body);
var loc = createLocFn(body);
var expected = {
kind: 'Document',
definitions: [
{
kind: 'TypeExtensionDefinition',
definition: {
kind: 'ObjectTypeDefinition',
name: nameNode('Hello', loc(13, 18)),
interfaces: [],
fields: [
fieldNode(
nameNode('world', loc(23, 28)),
typeNode('String', loc(30, 36)),
loc(23, 36)
)
],
loc: loc(8, 38),
},
loc: loc(1, 38),
}
],
loc: loc(1, 38)
};
expect(printJson(doc)).to.equal(printJson(expected));
});

it('Simple non-null type', () => {
var body = `
type Hello {
Expand Down

0 comments on commit 9ffe3c7

Please sign in to comment.