File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -587,6 +587,56 @@ describe('Execute: defer directive', () => {
587587 ] ) ;
588588 } ) ;
589589
590+ it ( 'Separately emits defer fragments with different labels with varying subfields that return promises' , async ( ) => {
591+ const document = parse ( `
592+ query HeroNameQuery {
593+ ... @defer(label: "DeferID") {
594+ hero {
595+ id
596+ }
597+ }
598+ ... @defer(label: "DeferName") {
599+ hero {
600+ name
601+ }
602+ }
603+ }
604+ ` ) ;
605+ const result = await complete ( document , {
606+ hero : {
607+ id : ( ) => Promise . resolve ( '1' ) ,
608+ name : ( ) => Promise . resolve ( 'Luke' ) ,
609+ } ,
610+ } ) ;
611+ expectJSON ( result ) . toDeepEqual ( [
612+ {
613+ data : { } ,
614+ hasNext : true ,
615+ } ,
616+ {
617+ incremental : [
618+ {
619+ data : { hero : { } } ,
620+ path : [ ] ,
621+ } ,
622+ {
623+ data : { id : '1' } ,
624+ path : [ 'hero' ] ,
625+ } ,
626+ {
627+ data : { name : 'Luke' } ,
628+ path : [ 'hero' ] ,
629+ } ,
630+ ] ,
631+ completed : [
632+ { path : [ ] , label : 'DeferID' } ,
633+ { path : [ ] , label : 'DeferName' } ,
634+ ] ,
635+ hasNext : false ,
636+ } ,
637+ ] ) ;
638+ } ) ;
639+
590640 it ( 'Separately emits defer fragments with varying subfields of same priorities but different level of defers' , async ( ) => {
591641 const document = parse ( `
592642 query HeroNameQuery {
You can’t perform that action at this time.
0 commit comments