Skip to content

Commit 45faf79

Browse files
committed
coverage for fillLeafsOnComplete
1 parent 11245e2 commit 45faf79

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

packages/graphql-language-service-server/src/GraphQLLanguageService.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,7 @@ export class GraphQLLanguageService {
542542
dependencies.concat(localFragInfos),
543543
);
544544
}
545+
545546
async getOutline(documentText: string): Promise<Outline | null> {
546547
return getOutline(documentText);
547548
}

packages/graphql-language-service/src/interface/__tests__/getAutocompleteSuggestions-test.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,45 @@ describe('getAutocompleteSuggestions', () => {
253253
]);
254254
});
255255

256+
it('provides correct field name suggestions with insertText', () => {
257+
const result = testSuggestions('{ ', new Position(0, 2), [], {
258+
ignoreInsert: false,
259+
fillLeafsOnComplete: true,
260+
});
261+
expect(result).toEqual([
262+
{
263+
label: '__typename',
264+
detail: 'String!',
265+
command: suggestionCommand,
266+
insertTextFormat: 2,
267+
insertText: '__typename\n',
268+
},
269+
{
270+
...expectedResults.droid,
271+
command: suggestionCommand,
272+
insertTextFormat: 2,
273+
insertText: 'droid(id: $1) {\n $1\n}',
274+
},
275+
{
276+
...expectedResults.hero,
277+
command: suggestionCommand,
278+
insertTextFormat: 2,
279+
insertText: 'hero {\n $1\n}',
280+
},
281+
{
282+
...expectedResults.human,
283+
command: suggestionCommand,
284+
insertTextFormat: 2,
285+
insertText: 'human(id: $1) {\n $1\n}',
286+
},
287+
{
288+
...expectedResults.inputTypeTest,
289+
command: suggestionCommand,
290+
insertTextFormat: 2,
291+
insertText: 'inputTypeTest {\n $1\n}',
292+
},
293+
]);
294+
});
256295
it('provides correct type suggestions for fragments', () => {
257296
const result = testSuggestions('fragment test on ', new Position(0, 17));
258297

0 commit comments

Comments
 (0)