File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ const query = new GraphQLObjectType({
71
71
async * resolve ( ) {
72
72
yield friends [ 0 ] . name ;
73
73
yield { } ;
74
+ yield friends [ 2 ] . name ;
74
75
} ,
75
76
} ,
76
77
asyncIterableListDelayed : {
@@ -464,6 +465,42 @@ describe('Execute: stream directive', () => {
464
465
} ,
465
466
] ) ;
466
467
} ) ;
468
+ it ( 'Handles errors thrown by completeValue before initialCount is reached' , async ( ) => {
469
+ const document = parse ( `
470
+ query {
471
+ asyncIterableInvalid @stream(initialCount: 2)
472
+ }
473
+ ` ) ;
474
+ const result = await complete ( document ) ;
475
+ expect ( result ) . to . deep . equal ( [
476
+ {
477
+ data : {
478
+ asyncIterableInvalid : [ 'Luke' , null ] ,
479
+ } ,
480
+ errors : [
481
+ {
482
+ message : 'String cannot represent value: {}' ,
483
+ locations : [
484
+ {
485
+ line : 3 ,
486
+ column : 9 ,
487
+ } ,
488
+ ] ,
489
+ path : [ 'asyncIterableInvalid' , 1 ] ,
490
+ } ,
491
+ ] ,
492
+ hasNext : true ,
493
+ } ,
494
+ {
495
+ data : 'Leia' ,
496
+ path : [ 'asyncIterableInvalid' , 2 ] ,
497
+ hasNext : true ,
498
+ } ,
499
+ {
500
+ hasNext : false ,
501
+ } ,
502
+ ] ) ;
503
+ } ) ;
467
504
it ( 'Handles errors thrown by completeValue after initialCount is reached' , async ( ) => {
468
505
const document = parse ( `
469
506
query {
@@ -495,6 +532,11 @@ describe('Execute: stream directive', () => {
495
532
] ,
496
533
hasNext : true ,
497
534
} ,
535
+ {
536
+ data : 'Leia' ,
537
+ path : [ 'asyncIterableInvalid' , 2 ] ,
538
+ hasNext : true ,
539
+ } ,
498
540
{
499
541
hasNext : false ,
500
542
} ,
You can’t perform that action at this time.
0 commit comments