import { MockRouter , mockRequestHandler , mockDependencies } from '../../__mocks__' ; import { registerDocumentsRoutes , registerDocumentRoutes } from './documents' ; describe ( 'documents routes' , ( ) => { describe ( 'POST /internal/app_search/engines/{engineName}/documents' , ( ) => { let mockRouter ; beforeEach ( ( ) => { jest . clearAllMocks ( ) ; mockRouter = new MockRouter ( { method : 'post' , path : '/internal/app_search/engines/{engineName}/documents' , } ) ; registerDocumentsRoutes ( { ... mockDependencies , router : mockRouter . router , } ) ; } ) ; it ( 'creates a request to enterprise search' , ( ) => { expect ( mockRequestHandler . createRequest ) . toHaveBeenCalledWith ( { path : '/as/engines/:engineName/documents/new' , } ) ; } ) ; } ) ; } ) ; describe ( 'document routes' , ( ) => { describe ( 'GET /internal/app_search/engines/{engineName}/documents/{documentId}' , ( ) => { let mockRouter ; beforeEach ( ( ) => { jest . clearAllMocks ( ) ; mockRouter = new MockRouter ( { method : 'get' , path : '/internal/app_search/engines/{engineName}/documents/{documentId}' , } ) ; registerDocumentRoutes ( { ... mockDependencies , router : mockRouter . router , } ) ; } ) ; it ( 'creates a request to enterprise search' , ( ) => { expect ( mockRequestHandler . createRequest ) . toHaveBeenCalledWith ( { path : '/as/engines/:engineName/documents/:documentId' , } ) ; } ) ; } ) ; describe ( 'DELETE /internal/app_search/engines/{engineName}/documents/{documentId}' , ( ) => { let mockRouter ; beforeEach ( ( ) => { jest . clearAllMocks ( ) ; mockRouter = new MockRouter ( { method : 'delete' , path : '/internal/app_search/engines/{engineName}/documents/{documentId}' , } ) ; registerDocumentRoutes ( { ... mockDependencies , router : mockRouter . router , } ) ; } ) ; it ( 'creates a request to enterprise search' , ( ) => { expect ( mockRequestHandler . createRequest ) . toHaveBeenCalledWith ( { path : '/as/engines/:engineName/documents/:documentId' , } ) ; } ) ; } ) ; } ) ;