Skip to content

Commit

Permalink
coverage for fillLeafsOnComplete
Browse files Browse the repository at this point in the history
  • Loading branch information
acao committed May 18, 2024
1 parent 11245e2 commit 45faf79
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ export class GraphQLLanguageService {
dependencies.concat(localFragInfos),
);
}

async getOutline(documentText: string): Promise<Outline | null> {
return getOutline(documentText);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,45 @@ describe('getAutocompleteSuggestions', () => {
]);
});

it('provides correct field name suggestions with insertText', () => {
const result = testSuggestions('{ ', new Position(0, 2), [], {
ignoreInsert: false,
fillLeafsOnComplete: true,
});
expect(result).toEqual([
{
label: '__typename',
detail: 'String!',
command: suggestionCommand,
insertTextFormat: 2,
insertText: '__typename\n',
},
{
...expectedResults.droid,
command: suggestionCommand,
insertTextFormat: 2,
insertText: 'droid(id: $1) {\n $1\n}',
},
{
...expectedResults.hero,
command: suggestionCommand,
insertTextFormat: 2,
insertText: 'hero {\n $1\n}',
},
{
...expectedResults.human,
command: suggestionCommand,
insertTextFormat: 2,
insertText: 'human(id: $1) {\n $1\n}',
},
{
...expectedResults.inputTypeTest,
command: suggestionCommand,
insertTextFormat: 2,
insertText: 'inputTypeTest {\n $1\n}',
},
]);
});
it('provides correct type suggestions for fragments', () => {
const result = testSuggestions('fragment test on ', new Position(0, 17));

Expand Down

0 comments on commit 45faf79

Please sign in to comment.