@@ -528,7 +528,20 @@ describe('getAutocompleteSuggestions', () => {
528
528
expect ( testSuggestions ( 'query @' , new Position ( 0 , 7 ) ) ) . toEqual ( [ ] ) ;
529
529
} ) ;
530
530
531
- it ( 'provides correct testInput suggestions' , ( ) => {
531
+ it ( 'provides correct directive field suggestions' , ( ) => {
532
+ expect (
533
+ testSuggestions ( '{ test @deprecated(' , new Position ( 0 , 19 ) ) ,
534
+ ) . toEqual ( [
535
+ {
536
+ command : suggestionCommand ,
537
+ label : 'reason' ,
538
+ insertTextFormat : 2 ,
539
+ insertText : 'reason: ' ,
540
+ } ,
541
+ ] ) ;
542
+ } ) ;
543
+
544
+ it ( 'provides correct testInput type field suggestions' , ( ) => {
532
545
expect (
533
546
testSuggestions ( '{ inputTypeTest(args: {' , new Position ( 0 , 23 ) ) ,
534
547
) . toEqual ( [
@@ -539,6 +552,41 @@ describe('getAutocompleteSuggestions', () => {
539
552
insertTextFormat : 2 ,
540
553
command : suggestionCommand ,
541
554
} ,
555
+ {
556
+ detail : 'InputType' ,
557
+ label : 'obj' ,
558
+ insertText : 'obj: {\n $1\n}' ,
559
+ command : suggestionCommand ,
560
+ insertTextFormat : 2 ,
561
+ } ,
562
+ {
563
+ label : 'value' ,
564
+ detail : 'Int' ,
565
+ insertText : 'value: ' ,
566
+ insertTextFormat : 2 ,
567
+ command : suggestionCommand ,
568
+ } ,
569
+ ] ) ;
570
+ } ) ;
571
+
572
+ it ( 'provides correct nested testInput type field suggestions' , ( ) => {
573
+ expect (
574
+ testSuggestions ( '{ inputTypeTest(args: { obj: {' , new Position ( 0 , 30 ) ) ,
575
+ ) . toEqual ( [
576
+ {
577
+ label : 'key' ,
578
+ detail : 'String!' ,
579
+ insertText : 'key: ' ,
580
+ insertTextFormat : 2 ,
581
+ command : suggestionCommand ,
582
+ } ,
583
+ {
584
+ detail : 'InputType' ,
585
+ label : 'obj' ,
586
+ insertText : 'obj: {\n $1\n}' ,
587
+ command : suggestionCommand ,
588
+ insertTextFormat : 2 ,
589
+ } ,
542
590
{
543
591
label : 'value' ,
544
592
detail : 'Int' ,
@@ -705,6 +753,38 @@ describe('getAutocompleteSuggestions', () => {
705
753
expect ( testSuggestions ( 'type Type @' , new Position ( 0 , 11 ) ) ) . toEqual ( [
706
754
{ label : 'onAllDefs' } ,
707
755
] ) ) ;
756
+ it ( 'provides correct suggestions on object field w/ .graphqls' , ( ) =>
757
+ expect (
758
+ testSuggestions ( 'type Type {\n aField: s' , new Position ( 0 , 23 ) , [ ] , {
759
+ uri : 'schema.graphqls' ,
760
+ ignoreInsert : true ,
761
+ } ) ,
762
+ ) . toEqual ( [
763
+ { label : 'Episode' } ,
764
+ { label : 'String' } ,
765
+ { label : 'TestInterface' } ,
766
+ { label : 'TestType' } ,
767
+ { label : 'TestUnion' } ,
768
+ ] ) ) ;
769
+
770
+ it ( 'provides correct argument type suggestions on directive definitions' , ( ) =>
771
+ expect (
772
+ testSuggestions (
773
+ 'directive @skip(if: ) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT' ,
774
+ new Position ( 0 , 19 ) ,
775
+ [ ] ,
776
+ {
777
+ ignoreInsert : true ,
778
+ } ,
779
+ ) ,
780
+ ) . toEqual ( [
781
+ { label : 'Boolean' } ,
782
+ { label : 'Episode' } ,
783
+ { label : 'InputType' } ,
784
+ { label : 'Int' } ,
785
+ { label : 'String' } ,
786
+ ] ) ) ;
787
+
708
788
it ( 'provides correct suggestions on object field w/ .graphqls' , ( ) =>
709
789
expect (
710
790
testSuggestions ( 'type Type {\n aField: s' , new Position ( 0 , 23 ) , [ ] , {
0 commit comments