diff --git a/x-pack/plugins/enterprise_search/public/applications/__mocks__/index.ts b/x-pack/plugins/enterprise_search/public/applications/__mocks__/index.ts new file mode 100644 index 0000000000000..cfe5a1e4c4ee2 --- /dev/null +++ b/x-pack/plugins/enterprise_search/public/applications/__mocks__/index.ts @@ -0,0 +1,11 @@ +/* + * 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. + */ + +export { mockHistory } from './react_router_history.mock'; +export { mockKibanaContext } from './kibana_context.mock'; +export { mountWithKibanaContext } from './mount_with_context.mock'; + +// Note: shallow_usecontext must be imported directly as a file diff --git a/x-pack/plugins/enterprise_search/public/applications/test_utils/mock_kibana_context.ts b/x-pack/plugins/enterprise_search/public/applications/__mocks__/kibana_context.mock.ts similarity index 100% rename from x-pack/plugins/enterprise_search/public/applications/test_utils/mock_kibana_context.ts rename to x-pack/plugins/enterprise_search/public/applications/__mocks__/kibana_context.mock.ts diff --git a/x-pack/plugins/enterprise_search/public/applications/test_utils/mount_with_context.tsx b/x-pack/plugins/enterprise_search/public/applications/__mocks__/mount_with_context.mock.tsx similarity index 93% rename from x-pack/plugins/enterprise_search/public/applications/test_utils/mount_with_context.tsx rename to x-pack/plugins/enterprise_search/public/applications/__mocks__/mount_with_context.mock.tsx index 856f3faa7332b..dcb5810d9fccc 100644 --- a/x-pack/plugins/enterprise_search/public/applications/test_utils/mount_with_context.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/__mocks__/mount_with_context.mock.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { mount } from 'enzyme'; import { KibanaContext } from '../'; -import { mockKibanaContext } from './mock_kibana_context'; +import { mockKibanaContext } from './kibana_context.mock'; /** * This helper mounts a component with a set of default KibanaContext, diff --git a/x-pack/plugins/enterprise_search/public/applications/test_utils/mock_rr_usehistory.ts b/x-pack/plugins/enterprise_search/public/applications/__mocks__/react_router_history.mock.ts similarity index 100% rename from x-pack/plugins/enterprise_search/public/applications/test_utils/mock_rr_usehistory.ts rename to x-pack/plugins/enterprise_search/public/applications/__mocks__/react_router_history.mock.ts diff --git a/x-pack/plugins/enterprise_search/public/applications/test_utils/mock_shallow_usecontext.ts b/x-pack/plugins/enterprise_search/public/applications/__mocks__/shallow_usecontext.mock.ts similarity index 94% rename from x-pack/plugins/enterprise_search/public/applications/test_utils/mock_shallow_usecontext.ts rename to x-pack/plugins/enterprise_search/public/applications/__mocks__/shallow_usecontext.mock.ts index eca7a7ab6e354..5193a0cd299f8 100644 --- a/x-pack/plugins/enterprise_search/public/applications/test_utils/mock_shallow_usecontext.ts +++ b/x-pack/plugins/enterprise_search/public/applications/__mocks__/shallow_usecontext.mock.ts @@ -8,7 +8,7 @@ * NOTE: This variable name MUST start with 'mock*' in order for * Jest to accept its use within a jest.mock() */ -import { mockKibanaContext } from './mock_kibana_context'; +import { mockKibanaContext } from './kibana_context.mock'; jest.mock('react', () => ({ ...jest.requireActual('react'), diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/empty_states/empty_states.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/empty_states/empty_states.test.tsx index e75970404dc5e..61b740f8ca888 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/empty_states/empty_states.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/empty_states/empty_states.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import '../../../test_utils/mock_shallow_usecontext'; +import '../../../__mocks__/shallow_usecontext.mock'; import React from 'react'; import { shallow } from 'enzyme'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/engine_overview.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/engine_overview.test.tsx index 8f707fe57bde7..2b712721a7fa5 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/engine_overview.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/engine_overview.test.tsx @@ -4,14 +4,14 @@ * you may not use this file except in compliance with the Elastic License. */ -import '../../../test_utils/mock_rr_usehistory'; +import '../../../__mocks__/react_router_history.mock'; import React from 'react'; import { act } from 'react-dom/test-utils'; import { render } from 'enzyme'; import { KibanaContext } from '../../../'; -import { mountWithKibanaContext, mockKibanaContext } from '../../../test_utils'; +import { mountWithKibanaContext, mockKibanaContext } from '../../../__mocks__'; import { EmptyState, ErrorState, NoUserState } from '../empty_states'; import { EngineTable } from './engine_table'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/engine_table.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/engine_table.test.tsx index 0c05131e80835..62305d7acb451 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/engine_table.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/engine_table.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { EuiBasicTable, EuiPagination, EuiButtonEmpty, EuiLink } from '@elastic/eui'; -import { mountWithKibanaContext } from '../../../test_utils'; +import { mountWithKibanaContext } from '../../../__mocks__'; jest.mock('../../../shared/telemetry', () => ({ sendTelemetry: jest.fn() })); import { sendTelemetry } from '../../../shared/telemetry'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview_header/engine_overview_header.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview_header/engine_overview_header.test.tsx index 03801e2b9f82d..b1ff1d9d25631 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview_header/engine_overview_header.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview_header/engine_overview_header.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import '../../../test_utils/mock_shallow_usecontext'; +import '../../../__mocks__/shallow_usecontext.mock'; import React, { useContext } from 'react'; import { shallow } from 'enzyme'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/index.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/index.test.tsx index 45d094f3c255a..57cd70389e807 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/index.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/index.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import '../test_utils/mock_shallow_usecontext'; +import '../__mocks__/shallow_usecontext.mock'; import React, { useContext } from 'react'; import { Redirect } from 'react-router-dom'; diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/kibana_breadcrumbs/generate_breadcrumbs.test.ts b/x-pack/plugins/enterprise_search/public/applications/shared/kibana_breadcrumbs/generate_breadcrumbs.test.ts index a76170fdf795e..cc6353fd3d3d0 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/kibana_breadcrumbs/generate_breadcrumbs.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/kibana_breadcrumbs/generate_breadcrumbs.test.ts @@ -7,7 +7,7 @@ import { generateBreadcrumb } from './generate_breadcrumbs'; import { appSearchBreadcrumbs, enterpriseSearchBreadcrumbs } from './'; -import { mockHistory } from '../../test_utils'; +import { mockHistory } from '../../__mocks__'; jest.mock('../react_router_helpers', () => ({ letBrowserHandleEvent: jest.fn(() => false) })); import { letBrowserHandleEvent } from '../react_router_helpers'; diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/kibana_breadcrumbs/set_breadcrumbs.test.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/kibana_breadcrumbs/set_breadcrumbs.test.tsx index 5da0effd15ba5..38aae0e499c92 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/kibana_breadcrumbs/set_breadcrumbs.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/kibana_breadcrumbs/set_breadcrumbs.test.tsx @@ -6,8 +6,8 @@ import React from 'react'; -import '../../test_utils/mock_rr_usehistory'; -import { mountWithKibanaContext } from '../../test_utils'; +import '../../__mocks__/react_router_history.mock'; +import { mountWithKibanaContext } from '../../__mocks__'; jest.mock('./generate_breadcrumbs', () => ({ appSearchBreadcrumbs: jest.fn() })); import { appSearchBreadcrumbs, SetAppSearchBreadcrumbs } from './'; diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/react_router_helpers/eui_link.test.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/react_router_helpers/eui_link.test.tsx index 0ae97383c93bb..eb9b9f3e35e06 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/react_router_helpers/eui_link.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/react_router_helpers/eui_link.test.tsx @@ -8,8 +8,8 @@ import React from 'react'; import { shallow } from 'enzyme'; import { EuiLink, EuiButton } from '@elastic/eui'; -import '../../test_utils/mock_rr_usehistory'; -import { mockHistory } from '../../test_utils'; +import '../../__mocks__/react_router_history.mock'; +import { mockHistory } from '../../__mocks__'; import { EuiReactRouterLink, EuiReactRouterButton } from './eui_link'; diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/telemetry/send_telemetry.test.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/telemetry/send_telemetry.test.tsx index 5548409591a3e..7f4a0d3f19074 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/telemetry/send_telemetry.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/telemetry/send_telemetry.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { httpServiceMock } from 'src/core/public/mocks'; -import { mountWithKibanaContext } from '../../test_utils'; +import { mountWithKibanaContext } from '../../__mocks__'; import { sendTelemetry, SendAppSearchTelemetry } from './'; describe('Shared Telemetry Helpers', () => { diff --git a/x-pack/plugins/enterprise_search/public/applications/test_utils/index.ts b/x-pack/plugins/enterprise_search/public/applications/test_utils/index.ts deleted file mode 100644 index 11627df8d15ba..0000000000000 --- a/x-pack/plugins/enterprise_search/public/applications/test_utils/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -/* - * 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. - */ - -export { mockHistory } from './mock_rr_usehistory'; -export { mockKibanaContext } from './mock_kibana_context'; -export { mountWithKibanaContext } from './mount_with_context'; - -// Note: mock_shallow_usecontext must be imported directly as a file