import { UiSettingsParams } from '../../../types' ; import { getThemeSettings } from './theme' ; describe ( 'theme settings' , ( ) => { const themeSettings = getThemeSettings ( ) ; const getValidationFn = ( setting ) => ( value ) => setting . schema . validate ( value ) ; describe ( 'theme:darkMode' , ( ) => { const validate = getValidationFn ( themeSettings [ 'theme:darkMode' ] ) ; 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]"` ) ; } ) ; } ) ; describe ( 'theme:version' , ( ) => { const validate = getValidationFn ( themeSettings [ 'theme:version' ] ) ; it ( 'should only accept valid values' , ( ) => { expect ( ( ) => validate ( 'v7' ) ) . not . toThrow ( ) ; expect ( ( ) => validate ( 'v8 (beta)' ) ) . not . toThrow ( ) ; expect ( ( ) => validate ( 'v12' ) ) . toThrowErrorMatchingInlineSnapshot ( `
"types that failed validation:
- [0]: expected value to equal [v7]
- [1]: expected value to equal [v8 (beta)]"
` ) ; } ) ; } ) ; } ) ;