import { UiSettingsParams } from '../../../types' ; import { getStateSettings } from './state' ; describe ( 'state settings' , ( ) => { const state = getStateSettings ( ) ; const getValidationFn = ( setting ) => ( value ) => setting . schema . validate ( value ) ; describe ( 'state:storeInSessionStorage' , ( ) => { const validate = getValidationFn ( state [ 'state:storeInSessionStorage' ] ) ; it ( 'should only accept boolean values' , ( ) => { expect ( ( ) => validate ( true ) ) . not . toThrow ( ) ; expect ( ( ) => validate ( false ) ) . not . toThrow ( ) ; expect ( ( ) => validate ( 'foo' ) ) . toThrowErrorMatchingInlineSnapshot ( `"expected value of type [boolean] but got [string]"` ) ; expect ( ( ) => validate ( 12 ) ) . toThrowErrorMatchingInlineSnapshot ( `"expected value of type [boolean] but got [number]"` ) ; } ) ; } ) ; } ) ;