import { isSafeString } from './is-safe-string.validator' ; describe ( 'IsSafeString' , ( ) => { describe ( 'isSafeString' , ( ) => { it ( 'should return true if the value is a string' , ( ) => { const result = isSafeString ( 'a string' ) ; expect ( result ) . toStrictEqual ( true ) ; } ) ; it ( 'should return true if the value is a string but empty' , ( ) => { const result = isSafeString ( '' ) ; expect ( result ) . toStrictEqual ( true ) ; } ) ; it ( 'should return false if the value is a wrong data' , ( ) => { const dataMock = { toString ( ) { return 'no' ; } , } ; const result = isSafeString ( JSON . stringify ( dataMock , null , 2 ) ) ; expect ( result ) . toStrictEqual ( false ) ; } ) ; it ( 'should return false if the value is not a string' , ( ) => { const result = isSafeString ( 42 as unknown as string ) ; expect ( result ) . toStrictEqual ( false ) ; } ) ; } ) ; } ) ;