File tree 1 file changed +12
-4
lines changed
1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -62,27 +62,35 @@ describe('Execute: Accepts any iterable as list value', () => {
62
62
] ,
63
63
} ) ;
64
64
} ) ;
65
+ } ) ;
66
+
67
+ describe ( 'Execute: Accepts async iterables as list value' , ( ) => {
68
+ function complete ( rootValue : mixed ) {
69
+ return execute ( {
70
+ schema : buildSchema ( 'type Query { listField: [String] }' ) ,
71
+ document : parse ( '{ listField }' ) ,
72
+ rootValue,
73
+ } ) ;
74
+ }
65
75
66
76
it ( 'Accepts an AsyncGenerator function as a List value' , async ( ) => {
67
- async function * yieldAsyncItems ( ) {
77
+ async function * listField ( ) {
68
78
yield await 'two' ;
69
79
yield await 4 ;
70
80
yield await false ;
71
81
}
72
- const listField = yieldAsyncItems ( ) ;
73
82
74
83
expect ( await complete ( { listField } ) ) . to . deep . equal ( {
75
84
data : { listField : [ 'two' , '4' , 'false' ] } ,
76
85
} ) ;
77
86
} ) ;
78
87
79
88
it ( 'Handles an AsyncGenerator function that throws' , async ( ) => {
80
- async function * yieldAsyncItemsError ( ) {
89
+ async function * listField ( ) {
81
90
yield await 'two' ;
82
91
yield await 4 ;
83
92
throw new Error ( 'bad' ) ;
84
93
}
85
- const listField = yieldAsyncItemsError ( ) ;
86
94
87
95
expect ( await complete ( { listField } ) ) . to . deep . equal ( {
88
96
data : { listField : [ 'two' , '4' , null ] } ,
You can’t perform that action at this time.
0 commit comments