import { validateRnippBirthdate } from './is-rnipp-birthdate.validator' ; describe ( 'IsRnippBirthdate' , ( ) => { it ( 'should return "false" if the argument is not a string' , ( ) => { const notAString = 42 ; const valid = validateRnippBirthdate ( notAString ) ; expect ( valid ) . toStrictEqual ( false ) ; } ) ; it ( 'should validate a date with YYYY-MM-DD format' , ( ) => { const date = '1992-04-23' ; const valid = validateRnippBirthdate ( date ) ; expect ( valid ) . toStrictEqual ( true ) ; } ) ; it ( 'should validate a date with YYYY-MM format' , ( ) => { const date = '1992-04' ; const valid = validateRnippBirthdate ( date ) ; expect ( valid ) . toStrictEqual ( true ) ; } ) ; it ( 'should validate a date with YYYY format' , ( ) => { const date = '1992' ; const valid = validateRnippBirthdate ( date ) ; expect ( valid ) . toStrictEqual ( true ) ; } ) ; it ( 'should not validate a date with YYYY-00-DD format' , ( ) => { const date = '1992-00-23' ; const valid = validateRnippBirthdate ( date ) ; expect ( valid ) . toStrictEqual ( false ) ; } ) ; it ( 'should not validate a badly formatted date' , ( ) => { const date = '1992-04-23-00' ; const valid = validateRnippBirthdate ( date ) ; expect ( valid ) . toStrictEqual ( false ) ; } ) ; it ( 'should not validate a random string' , ( ) => { const date = '0MmF-4o/ZkE$1' ; const valid = validateRnippBirthdate ( date ) ; expect ( valid ) . toStrictEqual ( false ) ; } ) ; it ( 'should not validate an invalid date (month)' , ( ) => { const date = '1992-99-23' ; const valid = validateRnippBirthdate ( date ) ; expect ( valid ) . toStrictEqual ( false ) ; } ) ; it ( 'should not validate an invalid date (day)' , ( ) => { const date = '1992-04-99' ; const valid = validateRnippBirthdate ( date ) ; expect ( valid ) . toStrictEqual ( false ) ; } ) ; } ) ;