import type { IRouter , RequestHandler , RequestHandlerContext } from 'src/core/server' ; import { kibanaResponseFactory } from 'src/core/server' ; import { httpServerMock } from 'src/core/server/mocks' ; import { routeDefinitionParamsMock } from './index.mock' ; import { defineStatusRoute } from './status' ; describe ( 'Status routes' , ( ) => { let router ; let mockRouteParams ; let mockContext ; beforeEach ( ( ) => { mockRouteParams = routeDefinitionParamsMock . create ( ) ; mockRouteParams . preboot . isSetupOnHold . mockReturnValue ( false ) ; router = mockRouteParams . router ; mockContext = { } as unknown as RequestHandlerContext ; defineStatusRoute ( mockRouteParams ) ; } ) ; describe ( '#status' , ( ) => { let routeHandler ; beforeEach ( ( ) => { const [ , statusRouteHandler ] = router . get . mock . calls . find ( ( [ { path } ] ) => path === '/internal/interactive_setup/status' ) ! ; routeHandler = statusRouteHandler ; } ) ; it ( 'should return connection status' , async ( ) => { const mockRequest = httpServerMock . createKibanaRequest ( ) ; await expect ( routeHandler ( mockContext , mockRequest , kibanaResponseFactory ) ) . resolves . toMatchInlineSnapshot ( `
              KibanaResponse {
                "options": Object {
                  "body": Object {
                    "connectionStatus": "configured",
                    "isSetupOnHold": false,
                  },
                },
                "payload": Object {
                  "connectionStatus": "configured",
                  "isSetupOnHold": false,
                },
                "status": 200,
              }
            ` ) ; } ) ; } ) ; } ) ;