@@ -64,6 +64,7 @@ const anotherNestedObject = new GraphQLObjectType({
64
64
65
65
const hero = {
66
66
name : 'Luke' ,
67
+ lastName : 'SkyWalker' ,
67
68
id : 1 ,
68
69
friends,
69
70
nestedObject,
@@ -112,6 +113,7 @@ const heroType = new GraphQLObjectType({
112
113
fields : {
113
114
id : { type : GraphQLID } ,
114
115
name : { type : GraphQLString } ,
116
+ lastName : { type : GraphQLString } ,
115
117
nonNullName : { type : new GraphQLNonNull ( GraphQLString ) } ,
116
118
friends : {
117
119
type : new GraphQLList ( friendType ) ,
@@ -566,6 +568,58 @@ describe('Execute: defer directive', () => {
566
568
] ) ;
567
569
} ) ;
568
570
571
+ it ( 'Separately emits defer fragments with different labels with varying subfields with superimposed masked defer' , async ( ) => {
572
+ const document = parse ( `
573
+ query HeroNameQuery {
574
+ ... @defer(label: "DeferID") {
575
+ hero {
576
+ id
577
+ }
578
+ }
579
+ ... @defer(label: "DeferName") {
580
+ hero {
581
+ name
582
+ lastName
583
+ ... @defer {
584
+ lastName
585
+ }
586
+ }
587
+ }
588
+ }
589
+ ` ) ;
590
+ const result = await complete ( document ) ;
591
+ expectJSON ( result ) . toDeepEqual ( [
592
+ {
593
+ data : { } ,
594
+ pending : [
595
+ { id : '0' , path : [ ] , label : 'DeferID' } ,
596
+ { id : '1' , path : [ ] , label : 'DeferName' } ,
597
+ ] ,
598
+ hasNext : true ,
599
+ } ,
600
+ {
601
+ incremental : [
602
+ {
603
+ data : { hero : { } } ,
604
+ id : '0' ,
605
+ } ,
606
+ {
607
+ data : { id : '1' } ,
608
+ id : '0' ,
609
+ subPath : [ 'hero' ] ,
610
+ } ,
611
+ {
612
+ data : { name : 'Luke' , lastName : 'SkyWalker' } ,
613
+ id : '1' ,
614
+ subPath : [ 'hero' ] ,
615
+ } ,
616
+ ] ,
617
+ completed : [ { id : '0' } , { id : '1' } ] ,
618
+ hasNext : false ,
619
+ } ,
620
+ ] ) ;
621
+ } ) ;
622
+
569
623
it ( 'Separately emits defer fragments with different labels with varying subfields that return promises' , async ( ) => {
570
624
const document = parse ( `
571
625
query HeroNameQuery {
0 commit comments