@@ -64,6 +64,7 @@ const anotherNestedObject = new GraphQLObjectType({
6464
6565const hero = {
6666 name : 'Luke' ,
67+ lastName : 'SkyWalker' ,
6768 id : 1 ,
6869 friends,
6970 nestedObject,
@@ -112,6 +113,7 @@ const heroType = new GraphQLObjectType({
112113 fields : {
113114 id : { type : GraphQLID } ,
114115 name : { type : GraphQLString } ,
116+ lastName : { type : GraphQLString } ,
115117 nonNullName : { type : new GraphQLNonNull ( GraphQLString ) } ,
116118 friends : {
117119 type : new GraphQLList ( friendType ) ,
@@ -566,6 +568,58 @@ describe('Execute: defer directive', () => {
566568 ] ) ;
567569 } ) ;
568570
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+
569623 it ( 'Separately emits defer fragments with different labels with varying subfields that return promises' , async ( ) => {
570624 const document = parse ( `
571625 query HeroNameQuery {
0 commit comments