import { getCustomErrorClass , MLClusterClientUninitialized , MLUISettingsClientUninitialized , MLFieldFormatRegistryUninitialized , } from './errors' ; describe ( 'Custom errors' , ( ) => { test ( 'creates a custom error instance' , ( ) => { const MLCustomError = getCustomErrorClass ( 'MLCustomError' ) ; const errorInstance = new MLCustomError ( 'farequote is not defined' ) ; expect ( errorInstance . message ) . toBe ( 'farequote is not defined' ) ; expect ( errorInstance . name ) . toBe ( 'MLCustomError' ) ; expect ( errorInstance ) . toBeInstanceOf ( MLCustomError ) ; expect ( errorInstance ) . toBeInstanceOf ( Error ) ; } ) ; test ( 'MLClusterClientUninitialized' , ( ) => { const errorInstance = new MLClusterClientUninitialized ( 'cluster client is not initialized' ) ; expect ( errorInstance . message ) . toBe ( 'cluster client is not initialized' ) ; expect ( errorInstance . name ) . toBe ( 'MLClusterClientUninitialized' ) ; expect ( errorInstance ) . toBeInstanceOf ( MLClusterClientUninitialized ) ; } ) ; test ( 'MLUISettingsClientUninitialized' , ( ) => { const errorInstance = new MLUISettingsClientUninitialized ( 'cluster client is not initialized' ) ; expect ( errorInstance . message ) . toBe ( 'cluster client is not initialized' ) ; expect ( errorInstance . name ) . toBe ( 'MLUISettingsClientUninitialized' ) ; expect ( errorInstance ) . toBeInstanceOf ( MLUISettingsClientUninitialized ) ; } ) ; test ( 'MLFieldFormatRegistryUninitialized' , ( ) => { const errorInstance = new MLFieldFormatRegistryUninitialized ( 'cluster client is not initialized' ) ; expect ( errorInstance . message ) . toBe ( 'cluster client is not initialized' ) ; expect ( errorInstance . name ) . toBe ( 'MLFieldFormatRegistryUninitialized' ) ; expect ( errorInstance ) . toBeInstanceOf ( MLFieldFormatRegistryUninitialized ) ; } ) ; } ) ;