-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Enterprise Search] Refactor product server route registrations to th…
…eir own files/folders (#82663) * Refactor all AS & WS route registrations to their own file/folders * Remove WS in route registrations since the main fn is already specific * Cover index.ts files - super basic, leaves out assertions to avoid brittleness * Move WS group routes to index.ts
- Loading branch information
Showing
8 changed files
with
85 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
x-pack/plugins/enterprise_search/server/routes/app_search/index.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { mockDependencies, MockRouter } from '../../__mocks__'; | ||
|
||
import { registerAppSearchRoutes } from './'; | ||
|
||
describe('registerAppSearchRoutes', () => { | ||
it('runs without errors', () => { | ||
const mockRouter = new MockRouter({} as any); | ||
registerAppSearchRoutes({ ...mockDependencies, router: mockRouter.router }); | ||
}); | ||
}); |
17 changes: 17 additions & 0 deletions
17
x-pack/plugins/enterprise_search/server/routes/app_search/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { IRouteDependencies } from '../../plugin'; | ||
|
||
import { registerEnginesRoute } from './engines'; | ||
import { registerCredentialsRoutes } from './credentials'; | ||
import { registerSettingsRoutes } from './settings'; | ||
|
||
export const registerAppSearchRoutes = (dependencies: IRouteDependencies) => { | ||
registerEnginesRoute(dependencies); | ||
registerCredentialsRoutes(dependencies); | ||
registerSettingsRoutes(dependencies); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
x-pack/plugins/enterprise_search/server/routes/workplace_search/index.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { mockDependencies, MockRouter } from '../../__mocks__'; | ||
|
||
import { registerWorkplaceSearchRoutes } from './'; | ||
|
||
describe('registerWorkplaceSearchRoutes', () => { | ||
it('runs without errors', () => { | ||
const mockRouter = new MockRouter({} as any); | ||
registerWorkplaceSearchRoutes({ ...mockDependencies, router: mockRouter.router }); | ||
}); | ||
}); |
29 changes: 29 additions & 0 deletions
29
x-pack/plugins/enterprise_search/server/routes/workplace_search/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { IRouteDependencies } from '../../plugin'; | ||
|
||
import { registerOverviewRoute } from './overview'; | ||
import { | ||
registerGroupsRoute, | ||
registerSearchGroupsRoute, | ||
registerGroupRoute, | ||
registerGroupUsersRoute, | ||
registerShareGroupRoute, | ||
registerAssignGroupRoute, | ||
registerBoostsGroupRoute, | ||
} from './groups'; | ||
|
||
export const registerWorkplaceSearchRoutes = (dependencies: IRouteDependencies) => { | ||
registerOverviewRoute(dependencies); | ||
registerGroupsRoute(dependencies); | ||
registerSearchGroupsRoute(dependencies); | ||
registerGroupRoute(dependencies); | ||
registerGroupUsersRoute(dependencies); | ||
registerShareGroupRoute(dependencies); | ||
registerAssignGroupRoute(dependencies); | ||
registerBoostsGroupRoute(dependencies); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters