import { isStringOrRegExp , IsStringOrRegExpConstraint , } from './is-string-or-regexp.validator' ; describe ( 'IsStringOrRegExpConstraint' , ( ) => { describe ( 'isStringOrRegExp' , ( ) => { it ( 'should return true if the value is a string' , ( ) => { const result = isStringOrRegExp ( 'a string' ) ; expect ( result ) . toStrictEqual ( true ) ; } ) ; it ( 'should return true if the value is a RegExp' , ( ) => { const result = isStringOrRegExp ( /RegExp/ ) ; expect ( result ) . toStrictEqual ( true ) ; } ) ; it ( 'should return false if the value is neither a string or a RegExp' , ( ) => { const result = isStringOrRegExp ( 42 ) ; expect ( result ) . toStrictEqual ( false ) ; } ) ; } ) ; describe ( 'defaultMessage' , ( ) => { it ( 'should return the default message' , ( ) => { const instance = new IsStringOrRegExpConstraint ( ) ; const result = instance . defaultMessage ( ) ; expect ( result ) . toStrictEqual ( 'The value must be a string or RegExp' ) ; } ) ; } ) ; } ) ;