Skip to content

Commit 4d6d964

Browse files
Add tests for parsing schema extensions
1 parent 60746a7 commit 4d6d964

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

packages/graphql-language-service/src/parser/__tests__/OnlineParser-test.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,49 @@ describe('onlineParser', () => {
6666

6767
t.eol();
6868
});
69+
70+
it('parses schema extension bare', () => {
71+
const { t } = getUtils(`
72+
extend schema
73+
`);
74+
75+
t.keyword('extend', { kind: 'ExtendDef' });
76+
t.keyword('schema', { kind: 'SchemaDef' });
77+
78+
t.eol();
79+
});
80+
81+
it('parses schema extension with operation defs', () => {
82+
const { t } = getUtils(`
83+
extend schema {
84+
query: SomeType
85+
}
86+
`);
87+
88+
t.keyword('extend', { kind: 'ExtendDef' });
89+
t.keyword('schema', { kind: 'SchemaDef' });
90+
t.punctuation('{');
91+
92+
t.keyword('query', { kind: 'OperationTypeDef' });
93+
t.punctuation(':');
94+
t.name('SomeType');
95+
96+
t.punctuation('}', { kind: 'Document' });
97+
98+
t.eol();
99+
});
100+
101+
it('parses schema extension with directive applications', () => {
102+
const { t } = getUtils(`
103+
extend schema @someDirective
104+
`);
105+
106+
t.keyword('extend', { kind: 'ExtendDef' });
107+
t.keyword('schema', { kind: 'SchemaDef' });
108+
expectDirective({ t }, { name: 'someDirective' });
109+
110+
t.eol();
111+
});
69112

70113
it('parses short query', () => {
71114
const { t } = getUtils(`

0 commit comments

Comments
 (0)