@@ -71,17 +71,33 @@ describe('isAsync()', () => {
7171 is : 'b' ,
7272 otherwise : Joi . string ( ) . external ( ( ) => { } )
7373 } ) . isAsync ( ) ) . to . be . true ( ) ;
74+ expect ( Joi . any ( ) . when ( 'a' , {
75+ is : 'b' ,
76+ otherwise : Joi . string ( )
77+ } ) . isAsync ( ) ) . to . be . false ( ) ;
7478 expect ( Joi . any ( ) . when ( 'a' , {
7579 switch : [
7680 { is : 'b' , then : Joi . string ( ) } ,
7781 { is : 'c' , then : Joi . number ( ) . external ( ( ) => { } ) , otherwise : Joi . string ( ) }
7882 ]
7983 } ) . isAsync ( ) ) . to . be . true ( ) ;
84+ expect ( Joi . any ( ) . when ( 'a' , {
85+ switch : [
86+ { is : 'b' , then : Joi . string ( ) } ,
87+ { is : 'c' , then : Joi . number ( ) , otherwise : Joi . string ( ) }
88+ ]
89+ } ) . isAsync ( ) ) . to . be . false ( ) ;
8090 expect ( Joi . any ( ) . when ( 'a' , {
8191 switch : [
8292 { is : 'b' , then : Joi . string ( ) } ,
8393 { is : 'c' , then : Joi . string ( ) , otherwise : Joi . number ( ) . external ( ( ) => { } ) }
8494 ]
8595 } ) . isAsync ( ) ) . to . be . true ( ) ;
96+ expect ( Joi . any ( ) . when ( 'a' , {
97+ switch : [
98+ { is : 'b' , then : Joi . string ( ) } ,
99+ { is : 'c' , then : Joi . string ( ) , otherwise : Joi . number ( ) }
100+ ]
101+ } ) . isAsync ( ) ) . to . be . false ( ) ;
86102 } ) ;
87103} ) ;
0 commit comments