import { UiSettingsParams } from '../../../types' ; import { getMiscUiSettings } from './misc' ; describe ( 'misc settings' , ( ) => { const miscSettings = getMiscUiSettings ( ) ; const getValidationFn = ( setting ) => ( value ) => setting . schema . validate ( value ) ; describe ( 'truncate:maxHeight' , ( ) => { const validate = getValidationFn ( miscSettings [ 'truncate:maxHeight' ] ) ; it ( 'should only accept positive numeric values' , ( ) => { expect ( ( ) => validate ( 127 ) ) . not . toThrow ( ) ; expect ( ( ) => validate ( - 12 ) ) . toThrowErrorMatchingInlineSnapshot ( `"Value must be equal to or greater than [0]."` ) ; expect ( ( ) => validate ( 'foo' ) ) . toThrowErrorMatchingInlineSnapshot ( `"expected value of type [number] but got [string]"` ) ; } ) ; } ) ; } ) ;