@@ -1406,12 +1406,18 @@ describe('[#20846] validateRecord — a readable date / datetime outside its yea
14061406 } ) ;
14071407
14081408 it ( 'CONTROL — a value that is not readable, or a number, keeps the ISO sentence' , ( ) => {
1409- expect ( refusal ( { at : 'not-a-date' } ) ) . toMatchObject ( { code : 'invalid_date' , message : 'At must be a valid datetime (ISO-8601)' } ) ;
1410- expect ( refusal ( { due : 'not-a-date' } ) ) . toMatchObject ( { code : 'invalid_date' , message : 'Due must be a valid date (ISO-8601)' } ) ;
14111409 // Epoch milliseconds in year 10000: never a written value, whatever its year.
14121410 const y10000 = Date . parse ( '+010000-01-01T00:00:00.000Z' ) ;
1413- expect ( refusal ( { at : y10000 } ) ) . toMatchObject ( { code : 'invalid_date' , message : 'At must be a valid datetime (ISO-8601)' } ) ;
1414- expect ( refusal ( { due : y10000 } ) ) . toMatchObject ( { code : 'invalid_date' , message : 'Due must be a valid date (ISO-8601)' } ) ;
1411+ for ( const [ data , sentence ] of [
1412+ [ { at : 'not-a-date' } , 'At must be a valid datetime (ISO-8601)' ] ,
1413+ [ { due : 'not-a-date' } , 'Due must be a valid date (ISO-8601)' ] ,
1414+ [ { at : y10000 } , 'At must be a valid datetime (ISO-8601)' ] ,
1415+ [ { due : y10000 } , 'Due must be a valid date (ISO-8601)' ] ,
1416+ ] as const ) {
1417+ const f = refusal ( data ) ;
1418+ expect ( f . code , JSON . stringify ( data ) ) . toBe ( 'invalid_date' ) ;
1419+ expect ( f . message , JSON . stringify ( data ) ) . toBe ( sentence ) ;
1420+ }
14151421 } ) ;
14161422
14171423 it ( 'CONTROL — a readable value inside the years, refused for its spelling, keeps the ISO sentence' , ( ) => {
0 commit comments