@@ -395,14 +395,46 @@ describe('coerceInputValue', () => {
395
395
expectValue ( result ) . to . deep . equal ( null ) ;
396
396
} ) ;
397
397
398
- it ( 'returns nested lists for nested non-list values' , ( ) => {
398
+ it ( 'returns error for nested non-list values' , ( ) => {
399
399
const result = coerceValue ( [ 1 , 2 , 3 ] , TestNestedList ) ;
400
- expectValue ( result ) . to . deep . equal ( [ [ 1 ] , [ 2 ] , [ 3 ] ] ) ;
400
+ expectErrors ( result ) . to . deep . equal ( [
401
+ {
402
+ error : 'Expected type "[Int]" to be a list.' ,
403
+ path : [ 0 ] ,
404
+ value : 1 ,
405
+ } ,
406
+ {
407
+ error : 'Expected type "[Int]" to be a list.' ,
408
+ path : [ 1 ] ,
409
+ value : 2 ,
410
+ } ,
411
+ {
412
+ error : 'Expected type "[Int]" to be a list.' ,
413
+ path : [ 2 ] ,
414
+ value : 3 ,
415
+ } ,
416
+ ] ) ;
401
417
} ) ;
402
418
403
- it ( 'returns nested null for nested null values' , ( ) => {
419
+ it ( 'returns errors for null values' , ( ) => {
404
420
const result = coerceValue ( [ 42 , [ null ] , null ] , TestNestedList ) ;
405
- expectValue ( result ) . to . deep . equal ( [ [ 42 ] , [ null ] , null ] ) ;
421
+ expectErrors ( result ) . to . deep . equal ( [
422
+ {
423
+ error : 'Expected type "[Int]" to be a list.' ,
424
+ path : [ 0 ] ,
425
+ value : 42 ,
426
+ } ,
427
+ {
428
+ error : 'Expected type "[Int]" to be a list.' ,
429
+ path : [ 2 ] ,
430
+ value : null ,
431
+ } ,
432
+ ] ) ;
433
+ } ) ;
434
+
435
+ it ( 'returns nested null for nested null values' , ( ) => {
436
+ const result = coerceValue ( [ [ null ] , [ null ] ] , TestNestedList ) ;
437
+ expectValue ( result ) . to . deep . equal ( [ [ null ] , [ null ] ] ) ;
406
438
} ) ;
407
439
} ) ;
408
440
0 commit comments