From 0da5e66c0511b3dd0987c024c5dd2ab39030ee4b Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Mon, 1 Jul 2024 12:13:41 -0700 Subject: [PATCH] Synced branch Signed-off-by: Ryan Liang --- .../public/doc_links/doc_links_service.ts | 2 +- .../mount_management_section.test.tsx | 122 ------------------ 2 files changed, 1 insertion(+), 123 deletions(-) delete mode 100644 src/plugins/data_source_management/public/management_app/mount_management_section.test.tsx diff --git a/src/core/public/doc_links/doc_links_service.ts b/src/core/public/doc_links/doc_links_service.ts index 81add4eefe7a..42263c7408e5 100644 --- a/src/core/public/doc_links/doc_links_service.ts +++ b/src/core/public/doc_links/doc_links_service.ts @@ -823,7 +823,7 @@ export interface DocLinksStart { readonly browser: string; readonly dataSource: { readonly guide: string; - readonly s3DataSource: string; + s3DataSource: string; }; readonly visualize: Record; readonly management: Record; diff --git a/src/plugins/data_source_management/public/management_app/mount_management_section.test.tsx b/src/plugins/data_source_management/public/management_app/mount_management_section.test.tsx deleted file mode 100644 index 7c4e7d812c6d..000000000000 --- a/src/plugins/data_source_management/public/management_app/mount_management_section.test.tsx +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - -import React from 'react'; -import { shallow } from 'enzyme'; -import { Route, Router, Switch } from 'react-router-dom'; -import { createMemoryHistory } from 'history'; -import { I18nProvider } from '@osd/i18n/react'; -import { - mountManagementSection, - DataSourceManagementStartDependencies, -} from './mount_management_section'; -import { StartServicesAccessor } from 'src/core/public'; -import { OpenSearchDashboardsContextProvider } from '../../../opensearch_dashboards_react/public'; -import { CreateDataSourcePanel } from '../components/data_source_creation_panel/create_data_source_panel'; -import { CreateDataSourceWizardWithRouter } from '../components/create_data_source_wizard'; -import { EditDataSourceWithRouter } from '../components/edit_data_source'; -import { DataSourceHomePanel } from '../components/data_source_home_panel/data_source_home_panel'; -import { ConfigureDirectQueryDataSourceWithRouter } from '../components/direct_query_data_sources_components/direct_query_data_source_configuration/configure_direct_query_data_sources'; -import { AuthenticationMethodRegistry } from '../auth_registry'; - -jest.mock('../components/data_source_creation_panel/create_data_source_panel', () => ({ - CreateDataSourcePanel: () =>
CreateDataSourcePanel
, -})); -jest.mock('../components/create_data_source_wizard', () => ({ - CreateDataSourceWizardWithRouter: () =>
CreateDataSourceWizardWithRouter
, -})); -jest.mock('../components/edit_data_source', () => ({ - EditDataSourceWithRouter: () =>
EditDataSourceWithRouter
, -})); -jest.mock('../components/data_source_home_panel/data_source_home_panel', () => ({ - DataSourceHomePanel: () =>
DataSourceHomePanel
, -})); -jest.mock( - '../components/direct_query_data_sources_components/direct_query_data_source_configuration/configure_direct_query_data_sources', - () => ({ - ConfigureDirectQueryDataSourceWithRouter: () => ( -
ConfigureDirectQueryDataSourceWithRouter
- ), - }) -); - -const mockStartServices: StartServicesAccessor = jest - .fn() - .mockResolvedValue([ - { - chrome: { docTitle: { reset: jest.fn() } }, - application: {}, - savedObjects: {}, - uiSettings: {}, - notifications: {}, - overlays: {}, - http: {}, - docLinks: {}, - }, - ]); - -const mockParams: any = { - element: document.createElement('div'), - history: createMemoryHistory(), // Use createMemoryHistory - setBreadcrumbs: jest.fn(), -}; - -const mockAuthMethodsRegistry: AuthenticationMethodRegistry = {} as AuthenticationMethodRegistry; - -describe('mountManagementSection', () => { - it('renders routes correctly with feature flag enabled', async () => { - await mountManagementSection(mockStartServices, mockParams, mockAuthMethodsRegistry, true); - const wrapper = shallow( - - - - - - - - - - - - - - ); - - expect(wrapper.find(Route)).toHaveLength(5); - const pathProp = wrapper.find(Route).at(3).prop('path'); - expect(pathProp).toEqual(['/:id']); - }); - - it('renders routes correctly with feature flag disabled', async () => { - await mountManagementSection(mockStartServices, mockParams, mockAuthMethodsRegistry, false); - const wrapper = shallow( - - - - - - - - - - - - ); - - expect(wrapper.find(Route)).toHaveLength(3); - wrapper.find(Route).forEach((route) => { - expect(route.prop('path')).not.toEqual(['/:id']); - }); - }); -});