File tree 1 file changed +52
-0
lines changed
1 file changed +52
-0
lines changed Original file line number Diff line number Diff line change @@ -536,6 +536,58 @@ describe('Execute: Handles basic execution tasks', () => {
536
536
] ) ;
537
537
} ) ;
538
538
539
+ it ( 'nulls error subtree for promise rejection #1071' , async ( ) => {
540
+ const query = `
541
+ query {
542
+ foods {
543
+ name
544
+ }
545
+ }
546
+ ` ;
547
+
548
+ const schema = new GraphQLSchema ( {
549
+ query : new GraphQLObjectType ( {
550
+ name : 'Query' ,
551
+ fields : {
552
+ foods : {
553
+ type : new GraphQLList (
554
+ new GraphQLObjectType ( {
555
+ name : 'Food' ,
556
+ fields : {
557
+ name : { type : GraphQLString } ,
558
+ } ,
559
+ } ) ,
560
+ ) ,
561
+ resolve ( ) {
562
+ return Promise . reject ( new Error ( 'Dangit' ) ) ;
563
+ } ,
564
+ } ,
565
+ } ,
566
+ } ) ,
567
+ } ) ;
568
+
569
+ const ast = parse ( query ) ;
570
+ const result = await execute ( schema , ast ) ;
571
+
572
+ expect ( result ) . to . deep . equal ( {
573
+ data : {
574
+ foods : null ,
575
+ } ,
576
+ errors : [
577
+ {
578
+ locations : [
579
+ {
580
+ column : 9 ,
581
+ line : 3 ,
582
+ } ,
583
+ ] ,
584
+ message : 'Dangit' ,
585
+ path : [ 'foods' ] ,
586
+ } ,
587
+ ] ,
588
+ } ) ;
589
+ } ) ;
590
+
539
591
it ( 'Full response path is included for non-nullable fields' , async ( ) => {
540
592
const A = new GraphQLObjectType ( {
541
593
name : 'A' ,
You can’t perform that action at this time.
0 commit comments