import { act } from 'react-dom/test-utils' ; import { History , createMemoryHistory } from 'history' ; import { IBasePath } from '../../http' ; import { BasePath } from '../../http/base_path' ; import { renderApp } from './error_application' ; describe ( 'renderApp' , ( ) => { let basePath ; let element ; let history ; let unmount ; beforeEach ( ( ) => { basePath = new BasePath ( ) ; element = document . createElement ( 'div' ) ; history = createMemoryHistory ( ) ; unmount = renderApp ( { element , history } as any , { basePath } ) ; } ) ; afterEach ( ( ) => unmount ( ) ) ; it ( 'renders generic errors' , ( ) => { act ( ( ) => { history . push ( '/app/error' ) ; } ) ; expect ( element . querySelector ( '.euiTitle' ) ! . innerHTML ) . toMatchInlineSnapshot ( `"Application error"` ) ; } ) ; it ( 'renders urlOverflow errors' , ( ) => { act ( ( ) => { history . push ( '/app/error?errorType=urlOverflow' ) ; } ) ; expect ( element . querySelector ( '.euiTitle' ) ! . innerHTML ) . toMatchInlineSnapshot ( `"The URL for this object is too long, and we can't display it"` ) ; expect ( element . innerHTML ) . toMatch ( 'Things to try' ) ; } ) ; } ) ;