@@ -199,6 +199,11 @@ describe('graphql-hint', () => {
199
199
type : TestType ,
200
200
isDeprecated : false ,
201
201
} ,
202
+ {
203
+ text : 'example' ,
204
+ type : GraphQLString ,
205
+ isDeprecated : false ,
206
+ } ,
202
207
{
203
208
text : '__typename' ,
204
209
type : GraphQLNonNull ( GraphQLString ) ,
@@ -283,7 +288,7 @@ describe('graphql-hint', () => {
283
288
expect ( suggestions . list ) . to . deep . equal ( expectedSuggestions ) ;
284
289
} ) ;
285
290
286
- it ( 'provides correct argument suggestions after fileterd ' , async ( ) => {
291
+ it ( 'provides correct argument suggestions after filtered ' , async ( ) => {
287
292
const suggestions = await getHintSuggestions ( '{ hasArgs ( f' , {
288
293
line : 0 ,
289
294
ch : 13 ,
@@ -390,7 +395,7 @@ describe('graphql-hint', () => {
390
395
expect ( suggestions . list ) . to . deep . equal ( expectedSuggestions ) ;
391
396
} ) ;
392
397
393
- it ( 'provides correct directive suggestion after fileterd ' , async ( ) => {
398
+ it ( 'provides correct directive suggestion after filtered ' , async ( ) => {
394
399
const suggestions = await getHintSuggestions ( '{ test (@s' , {
395
400
line : 0 ,
396
401
ch : 10 ,
@@ -466,6 +471,55 @@ describe('graphql-hint', () => {
466
471
expect ( suggestions . list ) . to . deep . equal ( expectedSuggestions ) ;
467
472
} ) ;
468
473
474
+ it ( 'provides interface suggestions for type when using implements keyword' , async ( ) => {
475
+ const suggestions = await getHintSuggestions ( 'type Type implements ' , {
476
+ line : 0 ,
477
+ ch : 21 ,
478
+ } ) ;
479
+ const list = [
480
+ {
481
+ text : 'TestInterface' ,
482
+ type : TestSchema . getType ( 'TestInterface' ) ,
483
+ } ,
484
+ {
485
+ text : 'AnotherTestInterface' ,
486
+ type : TestSchema . getType ( 'AnotherTestInterface' ) ,
487
+ } ,
488
+ ] ;
489
+ const expectedSuggestions = getExpectedSuggestions ( list ) ;
490
+ expect ( suggestions . list ) . to . deep . equal ( expectedSuggestions ) ;
491
+ } ) ;
492
+
493
+ it ( 'provides interface suggestions for interface when using implements keyword' , async ( ) => {
494
+ const suggestions = await getHintSuggestions (
495
+ 'interface MyInt implements An' ,
496
+ { line : 0 , ch : 29 } ,
497
+ ) ;
498
+ const list = [
499
+ {
500
+ text : 'AnotherTestInterface' ,
501
+ type : TestSchema . getType ( 'AnotherTestInterface' ) ,
502
+ } ,
503
+ ] ;
504
+ const expectedSuggestions = getExpectedSuggestions ( list ) ;
505
+ expect ( suggestions . list ) . to . deep . equal ( expectedSuggestions ) ;
506
+ } ) ;
507
+
508
+ it ( 'provides interface suggestions for interface when using implements keyword and multiple interfaces' , async ( ) => {
509
+ const suggestions = await getHintSuggestions (
510
+ 'interface MyInt implements AnotherTestInterface & T' ,
511
+ { line : 0 , ch : 51 } ,
512
+ ) ;
513
+ const list = [
514
+ {
515
+ text : 'TestInterface' ,
516
+ type : TestSchema . getType ( 'TestInterface' ) ,
517
+ } ,
518
+ ] ;
519
+ const expectedSuggestions = getExpectedSuggestions ( list ) ;
520
+ expect ( suggestions . list ) . to . deep . equal ( expectedSuggestions ) ;
521
+ } ) ;
522
+
469
523
it ( 'provides correct typeCondition suggestions' , async ( ) => {
470
524
const suggestions = await getHintSuggestions ( '{ union { ... on ' , {
471
525
line : 0 ,
@@ -484,12 +538,16 @@ describe('graphql-hint', () => {
484
538
text : 'TestInterface' ,
485
539
description : '' ,
486
540
} ,
541
+ {
542
+ text : 'AnotherTestInterface' ,
543
+ description : '' ,
544
+ } ,
487
545
] ;
488
546
const expectedSuggestions = getExpectedSuggestions ( list ) ;
489
547
expect ( suggestions . list ) . to . deep . equal ( expectedSuggestions ) ;
490
548
} ) ;
491
549
492
- it ( 'provides correct typeCondition suggestions after filterd ' , async ( ) => {
550
+ it ( 'provides correct typeCondition suggestions after filtered ' , async ( ) => {
493
551
const suggestions = await getHintSuggestions ( '{ union { ... on F' , {
494
552
line : 0 ,
495
553
ch : 18 ,
@@ -503,6 +561,10 @@ describe('graphql-hint', () => {
503
561
text : 'TestInterface' ,
504
562
description : '' ,
505
563
} ,
564
+ {
565
+ text : 'AnotherTestInterface' ,
566
+ description : '' ,
567
+ } ,
506
568
] ;
507
569
const expectedSuggestions = getExpectedSuggestions ( list ) ;
508
570
expect ( suggestions . list ) . to . deep . equal ( expectedSuggestions ) ;
@@ -530,6 +592,10 @@ describe('graphql-hint', () => {
530
592
text : 'TestInterface' ,
531
593
description : '' ,
532
594
} ,
595
+ {
596
+ text : 'AnotherTestInterface' ,
597
+ description : '' ,
598
+ } ,
533
599
{
534
600
text : 'Second' ,
535
601
description : '' ,
@@ -707,7 +773,7 @@ describe('graphql-hint', () => {
707
773
708
774
it ( 'provides fragment names for fragments defined lower' , async ( ) => {
709
775
const suggestions = await getHintSuggestions (
710
- 'query { ... } fragment Foo on Test { id }' ,
776
+ 'query { ... }\nfragment Foo on Test { id }' ,
711
777
{ line : 0 , ch : 11 } ,
712
778
) ;
713
779
const list = [
@@ -769,6 +835,11 @@ describe('graphql-hint', () => {
769
835
type : TestType ,
770
836
isDeprecated : false ,
771
837
} ,
838
+ {
839
+ text : 'example' ,
840
+ type : GraphQLString ,
841
+ isDeprecated : false ,
842
+ } ,
772
843
{
773
844
text : '__typename' ,
774
845
type : GraphQLNonNull ( GraphQLString ) ,
@@ -796,14 +867,21 @@ describe('graphql-hint', () => {
796
867
type : TestType ,
797
868
isDeprecated : false ,
798
869
} ,
870
+ {
871
+ text : 'example' ,
872
+ type : GraphQLString ,
873
+ isDeprecated : false ,
874
+ } ,
799
875
{
800
876
text : '__typename' ,
801
877
type : GraphQLNonNull ( GraphQLString ) ,
802
878
description : 'The name of the current Object type at runtime.' ,
803
879
isDeprecated : false ,
804
880
} ,
805
881
] ;
882
+
806
883
const expectedSuggestions = getExpectedSuggestions ( list ) ;
884
+
807
885
expect ( suggestions . list ) . to . deep . equal ( expectedSuggestions ) ;
808
886
} ) ;
809
887
0 commit comments