import { MockRouter , mockRequestHandler , mockDependencies } from '../../__mocks__' ; import { registerSchemaRoutes } from './schema' ; describe ( 'schema routes' , ( ) => { describe ( 'GET /internal/app_search/engines/{engineName}/schema' , ( ) => { let mockRouter ; beforeEach ( ( ) => { jest . clearAllMocks ( ) ; mockRouter = new MockRouter ( { method : 'get' , path : '/internal/app_search/engines/{engineName}/schema' , } ) ; registerSchemaRoutes ( { ... mockDependencies , router : mockRouter . router , } ) ; } ) ; it ( 'creates a request handler' , ( ) => { expect ( mockRequestHandler . createRequest ) . toHaveBeenCalledWith ( { path : '/as/engines/:engineName/schema' , } ) ; } ) ; } ) ; describe ( 'POST /internal/app_search/engines/{engineName}/schema' , ( ) => { let mockRouter ; beforeEach ( ( ) => { jest . clearAllMocks ( ) ; mockRouter = new MockRouter ( { method : 'post' , path : '/internal/app_search/engines/{engineName}/schema' , } ) ; registerSchemaRoutes ( { ... mockDependencies , router : mockRouter . router , } ) ; } ) ; it ( 'creates a request handler' , ( ) => { expect ( mockRequestHandler . createRequest ) . toHaveBeenCalledWith ( { path : '/as/engines/:engineName/schema' , } ) ; } ) ; } ) ; describe ( 'GET /internal/app_search/engines/{engineName}/reindex_job/{reindexJobId}' , ( ) => { let mockRouter ; beforeEach ( ( ) => { jest . clearAllMocks ( ) ; mockRouter = new MockRouter ( { method : 'get' , path : '/internal/app_search/engines/{engineName}/reindex_job/{reindexJobId}' , } ) ; registerSchemaRoutes ( { ... mockDependencies , router : mockRouter . router , } ) ; } ) ; it ( 'creates a request handler' , ( ) => { expect ( mockRequestHandler . createRequest ) . toHaveBeenCalledWith ( { path : '/as/engines/:engineName/reindex_job/:reindexJobId' , } ) ; } ) ; } ) ; } ) ;