File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 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', () => {
6262 ] ,
6363 } ) ;
6464 } ) ;
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+ }
6575
6676 it ( 'Accepts an AsyncGenerator function as a List value' , async ( ) => {
67- async function * yieldAsyncItems ( ) {
77+ async function * listField ( ) {
6878 yield await 'two' ;
6979 yield await 4 ;
7080 yield await false ;
7181 }
72- const listField = yieldAsyncItems ( ) ;
7382
7483 expect ( await complete ( { listField } ) ) . to . deep . equal ( {
7584 data : { listField : [ 'two' , '4' , 'false' ] } ,
7685 } ) ;
7786 } ) ;
7887
7988 it ( 'Handles an AsyncGenerator function that throws' , async ( ) => {
80- async function * yieldAsyncItemsError ( ) {
89+ async function * listField ( ) {
8190 yield await 'two' ;
8291 yield await 4 ;
8392 throw new Error ( 'bad' ) ;
8493 }
85- const listField = yieldAsyncItemsError ( ) ;
8694
8795 expect ( await complete ( { listField } ) ) . to . deep . equal ( {
8896 data : { listField : [ 'two' , '4' , null ] } ,
You can’t perform that action at this time.
0 commit comments