File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -482,3 +482,51 @@ test('allof with local anchor reference', (t) => {
482
482
483
483
t . equal ( stringify ( data ) , JSON . stringify ( data ) )
484
484
} )
485
+
486
+ test ( 'allOf: throw Error if types mismatch ' , ( t ) => {
487
+ t . plan ( 1 )
488
+
489
+ const schema = {
490
+ allOf : [
491
+ { type : 'string' } ,
492
+ { type : 'number' }
493
+ ]
494
+ }
495
+ t . throws ( ( ) => build ( schema ) , new Error ( 'allOf schemas have different type values' ) )
496
+ } )
497
+
498
+ test ( 'allOf: throw Error if format mismatch ' , ( t ) => {
499
+ t . plan ( 1 )
500
+
501
+ const schema = {
502
+ allOf : [
503
+ { format : 'date' } ,
504
+ { format : 'time' }
505
+ ]
506
+ }
507
+ t . throws ( ( ) => build ( schema ) , new Error ( 'allOf schemas have different format values' ) )
508
+ } )
509
+
510
+ test ( 'allOf: throw Error if nullable mismatch /1' , ( t ) => {
511
+ t . plan ( 1 )
512
+
513
+ const schema = {
514
+ allOf : [
515
+ { nullable : true } ,
516
+ { nullable : false }
517
+ ]
518
+ }
519
+ t . throws ( ( ) => build ( schema ) , new Error ( 'allOf schemas have different nullable values' ) )
520
+ } )
521
+
522
+ test ( 'allOf: throw Error if nullable mismatch /2' , ( t ) => {
523
+ t . plan ( 1 )
524
+
525
+ const schema = {
526
+ allOf : [
527
+ { nullable : false } ,
528
+ { nullable : true }
529
+ ]
530
+ }
531
+ t . throws ( ( ) => build ( schema ) , new Error ( 'allOf schemas have different nullable values' ) )
532
+ } )
You can’t perform that action at this time.
0 commit comments