diff --git a/.eslintrc.js b/.eslintrc.js index a4ce657d523d9..22d0270a5b066 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1370,7 +1370,7 @@ module.exports = { { // Source files only - allow `any` in test/mock files files: ['x-pack/plugins/enterprise_search/**/*.{ts,tsx}'], - excludedFiles: ['x-pack/plugins/enterprise_search/**/*.{test,mock}.{ts,tsx}'], + excludedFiles: ['x-pack/plugins/enterprise_search/**/*.{test,mock,test_helper}.{ts,tsx}'], rules: { '@typescript-eslint/no-explicit-any': 'error', }, diff --git a/x-pack/plugins/enterprise_search/public/applications/__mocks__/flash_messages_logic.mock.ts b/x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/flash_messages_logic.mock.ts similarity index 89% rename from x-pack/plugins/enterprise_search/public/applications/__mocks__/flash_messages_logic.mock.ts rename to x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/flash_messages_logic.mock.ts index 6c31927cd75b0..36a10fd234bfe 100644 --- a/x-pack/plugins/enterprise_search/public/applications/__mocks__/flash_messages_logic.mock.ts +++ b/x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/flash_messages_logic.mock.ts @@ -29,8 +29,8 @@ export const mockFlashMessageHelpers = { flashErrorToast: jest.fn(), }; -jest.mock('../shared/flash_messages', () => ({ - ...(jest.requireActual('../shared/flash_messages') as object), +jest.mock('../../shared/flash_messages', () => ({ + ...(jest.requireActual('../../shared/flash_messages') as object), ...mockFlashMessageHelpers, FlashMessagesLogic: { values: mockFlashMessagesValues, diff --git a/x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/hooks.mock.ts b/x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/hooks.mock.ts new file mode 100644 index 0000000000000..ce21fd08f180a --- /dev/null +++ b/x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/hooks.mock.ts @@ -0,0 +1,65 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +/** + * Combine all shared mock values/actions into a single obj + * + * NOTE: These variable names MUST start with 'mock*' in order for + * Jest to accept its use within a jest.mock() + */ +import { mockFlashMessagesValues, mockFlashMessagesActions } from './flash_messages_logic.mock'; +import { mockHttpValues } from './http_logic.mock'; +import { mockKibanaValues } from './kibana_logic.mock'; +import { mockLicensingValues } from './licensing_logic.mock'; +import { mockTelemetryActions } from './telemetry_logic.mock'; + +export const mockAllValues = { + ...mockKibanaValues, + ...mockLicensingValues, + ...mockHttpValues, + ...mockFlashMessagesValues, +}; +export const mockAllActions = { + ...mockTelemetryActions, + ...mockFlashMessagesActions, +}; + +/** + * Import this file directly to mock useValues with a set of default values for all shared logic files. + * Example usage: + * + * import '../../../__mocks__/kea_logic'; // Must come before kea's import, adjust relative path as needed + */ +jest.mock('kea', () => ({ + ...(jest.requireActual('kea') as object), + useValues: jest.fn(() => ({ ...mockAllValues })), + useActions: jest.fn(() => ({ ...mockAllActions })), +})); + +/** + * React component helpers + * + * Call this function to override a specific set of Kea values while retaining all other defaults + * + * Example usage: + * + * import { setMockValues } from '../../../__mocks__/kea_logic'; + * import { SomeComponent } from './'; + * + * it('some test', () => { + * setMockValues({ someValue: 'hello' }); + * shallow(); + * }); + */ +import { useValues, useActions } from 'kea'; + +export const setMockValues = (values: object) => { + (useValues as jest.Mock).mockImplementation(() => ({ ...mockAllValues, ...values })); +}; +export const setMockActions = (actions: object) => { + (useActions as jest.Mock).mockImplementation(() => ({ ...mockAllActions, ...actions })); +}; diff --git a/x-pack/plugins/enterprise_search/public/applications/__mocks__/http_logic.mock.ts b/x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/http_logic.mock.ts similarity index 92% rename from x-pack/plugins/enterprise_search/public/applications/__mocks__/http_logic.mock.ts rename to x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/http_logic.mock.ts index 5399646a7b414..e60f5a1a8ba12 100644 --- a/x-pack/plugins/enterprise_search/public/applications/__mocks__/http_logic.mock.ts +++ b/x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/http_logic.mock.ts @@ -13,6 +13,6 @@ export const mockHttpValues = { readOnlyMode: false, }; -jest.mock('../shared/http', () => ({ +jest.mock('../../shared/http', () => ({ HttpLogic: { values: mockHttpValues }, })); diff --git a/x-pack/plugins/enterprise_search/public/applications/__mocks__/index.ts b/x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/index.ts similarity index 53% rename from x-pack/plugins/enterprise_search/public/applications/__mocks__/index.ts rename to x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/index.ts index 4e3a344b52e46..81901e6d0e103 100644 --- a/x-pack/plugins/enterprise_search/public/applications/__mocks__/index.ts +++ b/x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/index.ts @@ -5,7 +5,6 @@ * 2.0. */ -export { mockHistory, mockLocation } from './react_router_history.mock'; export { mockKibanaValues } from './kibana_logic.mock'; export { mockLicensingValues } from './licensing_logic.mock'; export { mockHttpValues } from './http_logic.mock'; @@ -15,18 +14,6 @@ export { mockFlashMessagesActions, mockFlashMessageHelpers, } from './flash_messages_logic.mock'; -export { - mockAllValues, - mockAllActions, - setMockValues, - setMockActions, - LogicMounter, -} from './kea.mock'; - -export { mountAsync } from './mount_async.mock'; -export { mountWithIntl } from './mount_with_i18n.mock'; -export { shallowWithIntl } from './shallow_with_i18n.mock'; -export { rerender } from './enzyme_rerender.mock'; -// Note: shallow_useeffect must be imported directly as a file +export { mockAllValues, mockAllActions, setMockValues, setMockActions } from './hooks.mock'; -export { expectedAsyncError } from './expected_async_error'; +export { LogicMounter } from './logic_mounter.test_helper'; diff --git a/x-pack/plugins/enterprise_search/public/applications/__mocks__/kibana_logic.mock.ts b/x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/kibana_logic.mock.ts similarity index 79% rename from x-pack/plugins/enterprise_search/public/applications/__mocks__/kibana_logic.mock.ts rename to x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/kibana_logic.mock.ts index 1ebd61df388c5..ebb6f8c4fe5aa 100644 --- a/x-pack/plugins/enterprise_search/public/applications/__mocks__/kibana_logic.mock.ts +++ b/x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/kibana_logic.mock.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { mockHistory } from './react_router_history.mock'; +import { chartPluginMock } from '../../../../../../../src/plugins/charts/public/mocks'; -import { chartPluginMock } from '../../../../../../src/plugins/charts/public/mocks'; +import { mockHistory } from '../react_router/state.mock'; export const mockKibanaValues = { config: { host: 'http://localhost:3002' }, @@ -24,6 +24,6 @@ export const mockKibanaValues = { renderHeaderActions: jest.fn(), }; -jest.mock('../shared/kibana', () => ({ +jest.mock('../../shared/kibana', () => ({ KibanaLogic: { values: mockKibanaValues }, })); diff --git a/x-pack/plugins/enterprise_search/public/applications/__mocks__/licensing_logic.mock.ts b/x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/licensing_logic.mock.ts similarity index 79% rename from x-pack/plugins/enterprise_search/public/applications/__mocks__/licensing_logic.mock.ts rename to x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/licensing_logic.mock.ts index d39ba56cdc1c1..2cea6061b63ab 100644 --- a/x-pack/plugins/enterprise_search/public/applications/__mocks__/licensing_logic.mock.ts +++ b/x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/licensing_logic.mock.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { licensingMock } from '../../../../licensing/public/mocks'; +import { licensingMock } from '../../../../../licensing/public/mocks'; export const mockLicensingValues = { license: licensingMock.createLicense(), @@ -13,6 +13,6 @@ export const mockLicensingValues = { hasGoldLicense: false, }; -jest.mock('../shared/licensing', () => ({ +jest.mock('../../shared/licensing', () => ({ LicensingLogic: { values: mockLicensingValues }, })); diff --git a/x-pack/plugins/enterprise_search/public/applications/__mocks__/kea.mock.ts b/x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/logic_mounter.test_helper.ts similarity index 62% rename from x-pack/plugins/enterprise_search/public/applications/__mocks__/kea.mock.ts rename to x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/logic_mounter.test_helper.ts index 4ebb9edd20c0e..08867fe944d15 100644 --- a/x-pack/plugins/enterprise_search/public/applications/__mocks__/kea.mock.ts +++ b/x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/logic_mounter.test_helper.ts @@ -6,67 +6,6 @@ */ /** - * Combine all shared mock values/actions into a single obj - * - * NOTE: These variable names MUST start with 'mock*' in order for - * Jest to accept its use within a jest.mock() - */ -import { mockFlashMessagesValues, mockFlashMessagesActions } from './flash_messages_logic.mock'; -import { mockHttpValues } from './http_logic.mock'; -import { mockKibanaValues } from './kibana_logic.mock'; -import { mockLicensingValues } from './licensing_logic.mock'; -import { mockTelemetryActions } from './telemetry_logic.mock'; - -export const mockAllValues = { - ...mockKibanaValues, - ...mockLicensingValues, - ...mockHttpValues, - ...mockFlashMessagesValues, -}; -export const mockAllActions = { - ...mockTelemetryActions, - ...mockFlashMessagesActions, -}; - -/** - * Import this file directly to mock useValues with a set of default values for all shared logic files. - * Example usage: - * - * import '../../../__mocks__/kea'; // Must come before kea's import, adjust relative path as needed - */ -jest.mock('kea', () => ({ - ...(jest.requireActual('kea') as object), - useValues: jest.fn(() => ({ ...mockAllValues })), - useActions: jest.fn(() => ({ ...mockAllActions })), -})); - -/** - * React component helpers - * - * Call this function to override a specific set of Kea values while retaining all other defaults - * - * Example usage: - * - * import { setMockValues } from '../../../__mocks__/kea.mock'; - * import { SomeComponent } from './'; - * - * it('some test', () => { - * setMockValues({ someValue: 'hello' }); - * shallow(); - * }); - */ -import { useValues, useActions } from 'kea'; - -export const setMockValues = (values: object) => { - (useValues as jest.Mock).mockImplementation(() => ({ ...mockAllValues, ...values })); -}; -export const setMockActions = (actions: object) => { - (useActions as jest.Mock).mockImplementation(() => ({ ...mockAllActions, ...actions })); -}; - -/** - * Kea logic helpers - * * Call this function to mount a logic file and optionally override default values. * Automatically DRYs out a lot of cruft for us, such as resetting context, creating the * nested defaults path obj (see https://kea.js.org/docs/api/context#resetcontext), and @@ -74,7 +13,7 @@ export const setMockActions = (actions: object) => { * * Example usage: * - * import { LogicMounter } from '../../../__mocks__/kea.mock'; + * import { LogicMounter } from '../../../__mocks__/kea_logic'; * import { SomeLogic } from './'; * * const { mount, unmount } = new LogicMounter(SomeLogic); diff --git a/x-pack/plugins/enterprise_search/public/applications/__mocks__/telemetry_logic.mock.ts b/x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/telemetry_logic.mock.ts similarity index 82% rename from x-pack/plugins/enterprise_search/public/applications/__mocks__/telemetry_logic.mock.ts rename to x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/telemetry_logic.mock.ts index 01b2e7cf103fb..fbc1537e733e7 100644 --- a/x-pack/plugins/enterprise_search/public/applications/__mocks__/telemetry_logic.mock.ts +++ b/x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/telemetry_logic.mock.ts @@ -12,7 +12,7 @@ export const mockTelemetryActions = { sendWorkplaceSearchTelemetry: jest.fn(), }; -jest.mock('../shared/telemetry', () => ({ - ...(jest.requireActual('../shared/telemetry') as object), +jest.mock('../../shared/telemetry', () => ({ + ...(jest.requireActual('../../shared/telemetry') as object), TelemetryLogic: { actions: mockTelemetryActions }, })); diff --git a/x-pack/plugins/enterprise_search/public/applications/__mocks__/react_router_history.mock.ts b/x-pack/plugins/enterprise_search/public/applications/__mocks__/react_router/hooks.mock.ts similarity index 53% rename from x-pack/plugins/enterprise_search/public/applications/__mocks__/react_router_history.mock.ts rename to x-pack/plugins/enterprise_search/public/applications/__mocks__/react_router/hooks.mock.ts index 8f0c63d46c8e7..5e867da7607fe 100644 --- a/x-pack/plugins/enterprise_search/public/applications/__mocks__/react_router_history.mock.ts +++ b/x-pack/plugins/enterprise_search/public/applications/__mocks__/react_router/hooks.mock.ts @@ -5,34 +5,21 @@ * 2.0. */ -/** - * NOTE: These variable names MUST start with 'mock*' in order for - * Jest to accept its use within a jest.mock() - */ -export const mockHistory = { - createHref: jest.fn(({ pathname }) => `/app/enterprise_search${pathname}`), - push: jest.fn(), - location: { - pathname: '/current-path', - }, - listen: jest.fn(() => jest.fn()), -} as any; -export const mockLocation = { - key: 'someKey', - pathname: '/current-path', - search: '?query=something', - hash: '#hash', - state: {}, -}; +import { mockHistory, mockLocation } from './state.mock'; + +export const mockUseHistory = jest.fn(() => mockHistory); +export const mockUseLocation = jest.fn(() => mockLocation); +export const mockUseParams = jest.fn(() => ({})); +export const mockUseRouteMatch = jest.fn(() => true); jest.mock('react-router-dom', () => { const originalModule = jest.requireActual('react-router-dom'); return { ...originalModule, - useHistory: jest.fn(() => mockHistory), - useLocation: jest.fn(() => mockLocation), - useParams: jest.fn(() => ({})), - useRouteMatch: jest.fn(() => null), + useHistory: mockUseHistory, + useLocation: mockUseLocation, + useParams: mockUseParams, + useRouteMatch: mockUseRouteMatch, // Note: RR's generatePath() opinionatedly encodeURI()s paths (although this doesn't actually // show up/affect the final browser URL). Since we already have a generateEncodedPath helper & // RR is removing this behavior in history 5.0+, I'm mocking tests to remove the extra encoding @@ -40,7 +27,3 @@ jest.mock('react-router-dom', () => { generatePath: jest.fn((path, params) => decodeURI(originalModule.generatePath(path, params))), }; }); - -/** - * For example usage, @see public/applications/shared/react_router_helpers/eui_link.test.tsx - */ diff --git a/x-pack/plugins/enterprise_search/public/applications/__mocks__/react_router/index.ts b/x-pack/plugins/enterprise_search/public/applications/__mocks__/react_router/index.ts new file mode 100644 index 0000000000000..0bf83135407b3 --- /dev/null +++ b/x-pack/plugins/enterprise_search/public/applications/__mocks__/react_router/index.ts @@ -0,0 +1,13 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +// State and hooks are stored in separate mock files for when a file needs to +// import a basic history mock without automatically jest.mock()ing all of React Router +export * from './state.mock'; +export * from './hooks.mock'; + +// For example usage, @see public/applications/shared/react_router_helpers/eui_link.test.tsx diff --git a/x-pack/plugins/enterprise_search/public/applications/__mocks__/react_router/state.mock.ts b/x-pack/plugins/enterprise_search/public/applications/__mocks__/react_router/state.mock.ts new file mode 100644 index 0000000000000..0ce8673530b00 --- /dev/null +++ b/x-pack/plugins/enterprise_search/public/applications/__mocks__/react_router/state.mock.ts @@ -0,0 +1,28 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +/** + * NOTE: These variable names MUST start with 'mock*' in order for + * Jest to accept its use within a jest.mock() + */ + +export const mockHistory = { + createHref: jest.fn(({ pathname }) => `/app/enterprise_search${pathname}`), + push: jest.fn(), + location: { + pathname: '/current-path', + }, + listen: jest.fn(() => jest.fn()), +} as any; + +export const mockLocation = { + key: 'someKey', + pathname: '/current-path', + search: '?query=something', + hash: '#hash', + state: {}, +}; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/app_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/app_logic.test.ts index f6497e5f5266b..7b08e82a4cf20 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/app_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/app_logic.test.ts @@ -6,7 +6,7 @@ */ import { DEFAULT_INITIAL_APP_DATA } from '../../../common/__mocks__'; -import { LogicMounter } from '../__mocks__'; +import { LogicMounter } from '../__mocks__/kea_logic'; import { AppLogic } from './app_logic'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/analytics_layout.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/analytics_layout.test.tsx index 291df04746418..9832915f19e9e 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/analytics_layout.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/analytics_layout.test.tsx @@ -6,16 +6,16 @@ */ import '../../../__mocks__/shallow_useeffect.mock'; -import '../../../__mocks__/react_router_history.mock'; -import { mockKibanaValues, setMockValues, setMockActions, rerender } from '../../../__mocks__'; +import { mockKibanaValues, setMockValues, setMockActions } from '../../../__mocks__/kea_logic'; +import { mockUseParams } from '../../../__mocks__/react_router'; import React from 'react'; -import { useParams } from 'react-router-dom'; import { shallow } from 'enzyme'; import { FlashMessages } from '../../../shared/flash_messages'; import { Loading } from '../../../shared/loading'; +import { rerender } from '../../../test_helpers'; import { LogRetentionCallout } from '../log_retention'; import { AnalyticsLayout } from './analytics_layout'; @@ -63,7 +63,7 @@ describe('AnalyticsLayout', () => { describe('data loading', () => { it('loads query data for query details pages', () => { - (useParams as jest.Mock).mockReturnValueOnce({ query: 'test' }); + mockUseParams.mockReturnValueOnce({ query: 'test' }); shallow(); expect(actions.loadQueryData).toHaveBeenCalledWith('test'); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/analytics_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/analytics_logic.test.ts index 3359143ad3672..921a0892bb890 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/analytics_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/analytics_logic.test.ts @@ -10,7 +10,7 @@ import { mockKibanaValues, mockHttpValues, mockFlashMessageHelpers, -} from '../../../__mocks__'; +} from '../../../__mocks__/kea_logic'; jest.mock('../engine', () => ({ EngineLogic: { values: { engineName: 'test-engine' } }, diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/components/analytics_chart.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/components/analytics_chart.test.tsx index 51238d62bdac7..8a5d2cbf89c4a 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/components/analytics_chart.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/components/analytics_chart.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { mockKibanaValues } from '../../../../__mocks__'; +import { mockKibanaValues } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/components/analytics_header.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/components/analytics_header.test.tsx index 952c4c2517a0e..5269ea9110065 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/components/analytics_header.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/components/analytics_header.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, mockKibanaValues } from '../../../../__mocks__'; +import { setMockValues, mockKibanaValues } from '../../../../__mocks__/kea_logic'; import React, { ReactElement } from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/components/analytics_search.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/components/analytics_search.test.tsx index 89fa5b4cc4b73..de04a21d48a23 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/components/analytics_search.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/components/analytics_search.test.tsx @@ -5,7 +5,8 @@ * 2.0. */ -import { mockKibanaValues } from '../../../../__mocks__'; +import { mockKibanaValues } from '../../../../__mocks__/kea_logic'; +import '../../../../__mocks__/react_router'; import '../../../__mocks__/engine_logic.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/components/analytics_tables/analytics_table.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/components/analytics_tables/analytics_table.test.tsx index 624cc57e1eb22..e25e4d8c16bb2 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/components/analytics_tables/analytics_table.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/components/analytics_tables/analytics_table.test.tsx @@ -5,13 +5,16 @@ * 2.0. */ -import { mountWithIntl } from '../../../../../__mocks__'; +import '../../../../../__mocks__/kea_logic'; +import '../../../../../__mocks__/react_router'; import '../../../../__mocks__/engine_logic.mock'; import React from 'react'; import { EuiBasicTable, EuiBadge, EuiEmptyPrompt } from '@elastic/eui'; +import { mountWithIntl } from '../../../../../test_helpers'; + import { runActionColumnTests } from './test_helpers/shared_columns_tests'; import { AnalyticsTable } from './'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/components/analytics_tables/query_clicks_table.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/components/analytics_tables/query_clicks_table.test.tsx index cc8f13299c57f..00cb12060822e 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/components/analytics_tables/query_clicks_table.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/components/analytics_tables/query_clicks_table.test.tsx @@ -5,13 +5,16 @@ * 2.0. */ -import { mountWithIntl } from '../../../../../__mocks__'; +import '../../../../../__mocks__/kea_logic'; +import '../../../../../__mocks__/react_router'; import '../../../../__mocks__/engine_logic.mock'; import React from 'react'; import { EuiBasicTable, EuiLink, EuiBadge, EuiEmptyPrompt } from '@elastic/eui'; +import { mountWithIntl } from '../../../../../test_helpers'; + import { QueryClicksTable } from './'; describe('QueryClicksTable', () => { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/components/analytics_tables/recent_queries_table.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/components/analytics_tables/recent_queries_table.test.tsx index 6021363183098..6ec89751a62e9 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/components/analytics_tables/recent_queries_table.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/components/analytics_tables/recent_queries_table.test.tsx @@ -5,13 +5,16 @@ * 2.0. */ -import { mountWithIntl } from '../../../../../__mocks__'; +import '../../../../../__mocks__/kea_logic'; +import '../../../../../__mocks__/react_router'; import '../../../../__mocks__/engine_logic.mock'; import React from 'react'; import { EuiBasicTable, EuiBadge, EuiEmptyPrompt } from '@elastic/eui'; +import { mountWithIntl } from '../../../../../test_helpers'; + import { runActionColumnTests } from './test_helpers/shared_columns_tests'; import { RecentQueriesTable } from './'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/components/analytics_tables/test_helpers/shared_columns_tests.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/components/analytics_tables/test_helpers/shared_columns_tests.tsx index 95af7b52487d4..cb3d340debd04 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/components/analytics_tables/test_helpers/shared_columns_tests.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/components/analytics_tables/test_helpers/shared_columns_tests.tsx @@ -9,7 +9,7 @@ import { mockHttpValues, mockKibanaValues, mockFlashMessageHelpers, -} from '../../../../../../__mocks__'; +} from '../../../../../../__mocks__/kea_logic'; import '../../../../../__mocks__/engine_logic.mock'; import { ReactWrapper } from 'enzyme'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/views/analytics.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/views/analytics.test.tsx index 688d5dec1a958..8496be6223764 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/views/analytics.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/views/analytics.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues } from '../../../../__mocks__'; +import { setMockValues } from '../../../../__mocks__/kea_logic'; import '../../../__mocks__/engine_logic.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/views/query_detail.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/views/query_detail.test.tsx index 978f11ddfd5cd..a942918fa9c62 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/views/query_detail.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/views/query_detail.test.tsx @@ -5,11 +5,10 @@ * 2.0. */ -import '../../../../__mocks__/react_router_history.mock'; -import { setMockValues } from '../../../../__mocks__'; +import { setMockValues } from '../../../../__mocks__/kea_logic'; +import { mockUseParams } from '../../../../__mocks__/react_router'; import React from 'react'; -import { useParams } from 'react-router-dom'; import { shallow } from 'enzyme'; @@ -24,7 +23,7 @@ describe('QueryDetail', () => { const mockBreadcrumbs = ['Engines', 'some-engine', 'Analytics']; beforeEach(() => { - (useParams as jest.Mock).mockReturnValue({ query: 'some-query' }); + mockUseParams.mockReturnValue({ query: 'some-query' }); setMockValues({ totalQueriesForQuery: 100, @@ -50,7 +49,7 @@ describe('QueryDetail', () => { }); it('renders empty "" search titles correctly', () => { - (useParams as jest.Mock).mockReturnValue({ query: '""' }); + mockUseParams.mockReturnValue({ query: '""' }); const wrapper = shallow(); expect(wrapper.find(AnalyticsLayout).prop('title')).toEqual('""'); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/views/recent_queries.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/views/recent_queries.test.tsx index 21d515a7b9795..20a25db3a7adf 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/views/recent_queries.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/views/recent_queries.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues } from '../../../../__mocks__'; +import { setMockValues } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/views/top_queries.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/views/top_queries.test.tsx index 46b2b37958435..98362e42c5536 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/views/top_queries.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/views/top_queries.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues } from '../../../../__mocks__'; +import { setMockValues } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/views/top_queries_no_clicks.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/views/top_queries_no_clicks.test.tsx index 83212160d1350..dfbda1c68ca84 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/views/top_queries_no_clicks.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/views/top_queries_no_clicks.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues } from '../../../../__mocks__'; +import { setMockValues } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/views/top_queries_no_results.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/views/top_queries_no_results.test.tsx index dfc5b9c93ab64..60e33660f87d7 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/views/top_queries_no_results.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/views/top_queries_no_results.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues } from '../../../../__mocks__'; +import { setMockValues } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/views/top_queries_with_clicks.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/views/top_queries_with_clicks.test.tsx index fb967ca06b387..b4c9f0fb40f71 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/views/top_queries_with_clicks.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/views/top_queries_with_clicks.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues } from '../../../../__mocks__'; +import { setMockValues } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/api_log/api_log_flyout.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/api_log/api_log_flyout.test.tsx index 6bebeee80465c..3ff22479f4013 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/api_log/api_log_flyout.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/api_log/api_log_flyout.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions } from '../../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic'; import { mockApiLog } from '../__mocks__/api_log.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/api_log/api_log_logic.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/api_log/api_log_logic.test.tsx index 2b7ca7510e8e1..e0d7c30bd0141 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/api_log/api_log_logic.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/api_log/api_log_logic.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { LogicMounter } from '../../../../__mocks__'; +import { LogicMounter } from '../../../../__mocks__/kea_logic'; import { mockApiLog } from '../__mocks__/api_log.mock'; import { ApiLogLogic } from './'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/api_logs.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/api_logs.test.tsx index cb29d92030ad7..c2a11ec06fa6a 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/api_logs.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/api_logs.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions, rerender } from '../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../__mocks__/kea_logic'; import '../../../__mocks__/shallow_useeffect.mock'; import '../../__mocks__/engine_logic.mock'; @@ -16,6 +16,7 @@ import { shallow } from 'enzyme'; import { EuiPageHeader } from '@elastic/eui'; import { Loading } from '../../../shared/loading'; +import { rerender } from '../../../test_helpers'; import { LogRetentionCallout, LogRetentionTooltip } from '../log_retention'; import { ApiLogsTable, NewApiEventsPrompt } from './components'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/api_logs_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/api_logs_logic.test.ts index 2eda4c6323fa5..5af5dca3e97dc 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/api_logs_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/api_logs_logic.test.ts @@ -5,7 +5,11 @@ * 2.0. */ -import { LogicMounter, mockHttpValues, mockFlashMessageHelpers } from '../../../__mocks__'; +import { + LogicMounter, + mockHttpValues, + mockFlashMessageHelpers, +} from '../../../__mocks__/kea_logic'; import { mockApiLog } from './__mocks__/api_log.mock'; import '../../__mocks__/engine_logic.mock'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/components/api_logs_table.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/components/api_logs_table.test.tsx index 780c198a9fac5..2a00cc6eb42bb 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/components/api_logs_table.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/components/api_logs_table.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions, mountWithIntl } from '../../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic'; // NOTE: We're mocking FormattedRelative here because it (currently) has // console warn issues, and it allows us to skip mocking dates @@ -21,6 +21,7 @@ import { shallow } from 'enzyme'; import { EuiBasicTable, EuiBadge, EuiHealth, EuiButtonEmpty, EuiEmptyPrompt } from '@elastic/eui'; import { DEFAULT_META } from '../../../../shared/constants'; +import { mountWithIntl } from '../../../../test_helpers'; import { ApiLogsTable } from './'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/components/new_api_events_prompt.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/components/new_api_events_prompt.test.tsx index 91d1962cd91db..5fd1d12f24842 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/components/new_api_events_prompt.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/components/new_api_events_prompt.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions } from '../../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_landing.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_landing.test.tsx index 132579bad8bdc..045fd9ee7be1b 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_landing.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_landing.test.tsx @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { setMockValues } from '../../../__mocks__'; +import { setMockValues } from '../../../__mocks__/kea_logic'; import { mockEngineValues } from '../../__mocks__'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview.test.tsx index eb30ae867b4b6..cc3fa21f73309 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { rerender, setMockActions, setMockValues } from '../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../__mocks__/kea_logic'; import '../../../__mocks__/shallow_useeffect.mock'; import React from 'react'; @@ -15,6 +15,7 @@ import { shallow, ShallowWrapper } from 'enzyme'; import { EuiCode } from '@elastic/eui'; import { Loading } from '../../../shared/loading'; +import { rerender } from '../../../test_helpers'; import { CrawlerOverview } from './crawler_overview'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview_logic.test.ts index 766f5dcfa02dc..f23322337766a 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview_logic.test.ts @@ -5,7 +5,11 @@ * 2.0. */ -import { LogicMounter, mockHttpValues, mockFlashMessageHelpers } from '../../../__mocks__'; +import { + LogicMounter, + mockHttpValues, + mockFlashMessageHelpers, +} from '../../../__mocks__/kea_logic'; import '../../__mocks__/engine_logic.mock'; import { nextTick } from '@kbn/test/jest'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_router.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_router.test.tsx index 351f547447803..c11c656333010 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_router.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_router.test.tsx @@ -4,8 +4,8 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { setMockValues } from '../../../__mocks__'; +import { setMockValues } from '../../../__mocks__/kea_logic'; import { mockEngineValues } from '../../__mocks__'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials.test.tsx index 3785873461f16..286658c011002 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions } from '../../../__mocks__/kea.mock'; +import { setMockValues, setMockActions } from '../../../__mocks__/kea_logic'; import { unmountHandler } from '../../../__mocks__/shallow_useeffect.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_flyout/body.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_flyout/body.test.tsx index 595bc1bcbb828..1ca6c0ce82855 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_flyout/body.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_flyout/body.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions } from '../../../../__mocks__/kea.mock'; +import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_flyout/footer.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_flyout/footer.test.tsx index 23e85b92bb8b4..d3312b5a1e369 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_flyout/footer.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_flyout/footer.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions } from '../../../../__mocks__/kea.mock'; +import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_flyout/form_components/key_engine_access.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_flyout/form_components/key_engine_access.test.tsx index 7247deb09f12b..d39ffb2bea206 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_flyout/form_components/key_engine_access.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_flyout/form_components/key_engine_access.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions, rerender } from '../../../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../../../__mocks__/kea_logic'; import React from 'react'; @@ -13,6 +13,8 @@ import { shallow } from 'enzyme'; import { EuiRadio, EuiCheckbox } from '@elastic/eui'; +import { rerender } from '../../../../../test_helpers'; + import { FormKeyEngineAccess, EngineSelection } from './key_engine_access'; describe('FormKeyEngineAccess', () => { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_flyout/form_components/key_name.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_flyout/form_components/key_name.test.tsx index d54d0c89c90cb..a206cdef4a737 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_flyout/form_components/key_name.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_flyout/form_components/key_name.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions } from '../../../../../__mocks__/kea.mock'; +import { setMockValues, setMockActions } from '../../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_flyout/form_components/key_read_write_access.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_flyout/form_components/key_read_write_access.test.tsx index cf45576d691cf..6f52a27dd628d 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_flyout/form_components/key_read_write_access.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_flyout/form_components/key_read_write_access.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions } from '../../../../../__mocks__/kea.mock'; +import { setMockValues, setMockActions } from '../../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_flyout/form_components/key_type.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_flyout/form_components/key_type.test.tsx index 5de2c7fda53ca..9cd518be2aaa5 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_flyout/form_components/key_type.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_flyout/form_components/key_type.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions } from '../../../../../__mocks__/kea.mock'; +import { setMockValues, setMockActions } from '../../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_flyout/header.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_flyout/header.test.tsx index 8ee7f810c1fa5..019a6c7043fb0 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_flyout/header.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_flyout/header.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues } from '../../../../__mocks__/kea.mock'; +import { setMockValues } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_flyout/index.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_flyout/index.test.tsx index 9932b8ca227b0..b86c1c592c4cd 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_flyout/index.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_flyout/index.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockActions } from '../../../../__mocks__/kea.mock'; +import { setMockActions } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_list/credentials_list.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_list/credentials_list.test.tsx index 274bda56a2fc1..13dd77da40931 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_list/credentials_list.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_list/credentials_list.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions } from '../../../../__mocks__/kea.mock'; +import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_logic.test.ts index bf84b03e7603e..7192488e49746 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_logic.test.ts @@ -5,7 +5,11 @@ * 2.0. */ -import { LogicMounter, mockFlashMessageHelpers, mockHttpValues } from '../../../__mocks__'; +import { + LogicMounter, + mockFlashMessageHelpers, + mockHttpValues, +} from '../../../__mocks__/kea_logic'; import { nextTick } from '@kbn/test/jest'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/curation.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/curation.test.tsx index ad4ba100145d9..937acfd84ce83 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/curation.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/curation.test.tsx @@ -5,12 +5,11 @@ * 2.0. */ -import '../../../../__mocks__/react_router_history.mock'; import '../../../../__mocks__/shallow_useeffect.mock'; -import { setMockActions, setMockValues, rerender } from '../../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../../__mocks__/kea_logic'; +import { mockUseParams } from '../../../../__mocks__/react_router'; import React from 'react'; -import { useParams } from 'react-router-dom'; import { shallow, ShallowWrapper } from 'enzyme'; @@ -18,6 +17,7 @@ import { EuiPageHeader } from '@elastic/eui'; import { SetAppSearchChrome as SetPageChrome } from '../../../../shared/kibana_chrome'; import { Loading } from '../../../../shared/loading'; +import { rerender } from '../../../../test_helpers'; jest.mock('./curation_logic', () => ({ CurationLogic: jest.fn() })); import { CurationLogic } from './curation_logic'; @@ -71,18 +71,18 @@ describe('Curation', () => { }); it('initializes CurationLogic with a curationId prop from URL param', () => { - (useParams as jest.Mock).mockReturnValueOnce({ curationId: 'hello-world' }); + mockUseParams.mockReturnValueOnce({ curationId: 'hello-world' }); shallow(); expect(CurationLogic).toHaveBeenCalledWith({ curationId: 'hello-world' }); }); it('calls loadCuration on page load & whenever the curationId URL param changes', () => { - (useParams as jest.Mock).mockReturnValueOnce({ curationId: 'cur-123456789' }); + mockUseParams.mockReturnValueOnce({ curationId: 'cur-123456789' }); const wrapper = shallow(); expect(actions.loadCuration).toHaveBeenCalledTimes(1); - (useParams as jest.Mock).mockReturnValueOnce({ curationId: 'cur-987654321' }); + mockUseParams.mockReturnValueOnce({ curationId: 'cur-987654321' }); rerender(wrapper); expect(actions.loadCuration).toHaveBeenCalledTimes(2); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/curation_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/curation_logic.test.ts index 17f7cd7cd154e..db387f581b92e 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/curation_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/curation_logic.test.ts @@ -10,7 +10,7 @@ import { mockHttpValues, mockKibanaValues, mockFlashMessageHelpers, -} from '../../../../__mocks__'; +} from '../../../../__mocks__/kea_logic'; import '../../../__mocks__/engine_logic.mock'; import { nextTick } from '@kbn/test/jest'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/documents/hidden_documents.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/documents/hidden_documents.test.tsx index 7ffa45c285320..c2377d0109494 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/documents/hidden_documents.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/documents/hidden_documents.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions } from '../../../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/documents/organic_documents.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/documents/organic_documents.test.tsx index 2a83ecfcada44..0624d0063e57d 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/documents/organic_documents.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/documents/organic_documents.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions } from '../../../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/documents/promoted_documents.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/documents/promoted_documents.test.tsx index 7240a443b76e9..e0c6de973666c 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/documents/promoted_documents.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/documents/promoted_documents.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions } from '../../../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/queries/active_query_select.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/queries/active_query_select.test.tsx index 65e8dbc96b636..f27c7ef959b50 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/queries/active_query_select.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/queries/active_query_select.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions } from '../../../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/queries/manage_queries_modal.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/queries/manage_queries_modal.test.tsx index 7fe992cdd96e2..1ff34c5875a0c 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/queries/manage_queries_modal.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/queries/manage_queries_modal.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions } from '../../../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/results/add_result_button.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/results/add_result_button.test.tsx index 19fc7e1784d3d..53cefdd00c670 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/results/add_result_button.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/results/add_result_button.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockActions } from '../../../../../__mocks__'; +import { setMockActions } from '../../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/results/add_result_flyout.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/results/add_result_flyout.test.tsx index a0f178aca32b2..71469e4e3f8cb 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/results/add_result_flyout.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/results/add_result_flyout.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockActions, setMockValues } from '../../../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/results/add_result_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/results/add_result_logic.test.ts index e7007cdc093cb..f1013fa4a6dfb 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/results/add_result_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/results/add_result_logic.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { LogicMounter } from '../../../../../__mocks__'; +import { LogicMounter } from '../../../../../__mocks__/kea_logic'; import '../../../../__mocks__/engine_logic.mock'; import { AddResultLogic } from './'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/results/curation_result.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/results/curation_result.test.tsx index 460c0f4dfa44c..67a26f2ecd4b6 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/results/curation_result.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/results/curation_result.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues } from '../../../../../__mocks__'; +import { setMockValues } from '../../../../../__mocks__/kea_logic'; import React from 'react'; import { DraggableProvidedDragHandleProps } from 'react-beautiful-dnd'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curations_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curations_logic.test.ts index c1031fc20bc15..f00f744f730ab 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curations_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curations_logic.test.ts @@ -10,7 +10,7 @@ import { mockHttpValues, mockKibanaValues, mockFlashMessageHelpers, -} from '../../../__mocks__'; +} from '../../../__mocks__/kea_logic'; import '../../__mocks__/engine_logic.mock'; import { nextTick } from '@kbn/test/jest'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curation_creation.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curation_creation.test.tsx index 258d0ec6231fc..ad306dfc73080 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curation_creation.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curation_creation.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockActions } from '../../../../__mocks__'; +import { setMockActions } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations.test.tsx index 1be21c97c623b..bcc402d6eea27 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations.test.tsx @@ -5,12 +5,7 @@ * 2.0. */ -import { - mountWithIntl, - mockKibanaValues, - setMockActions, - setMockValues, -} from '../../../../__mocks__'; +import { mockKibanaValues, setMockActions, setMockValues } from '../../../../__mocks__/kea_logic'; import '../../../__mocks__/engine_logic.mock'; import React from 'react'; @@ -20,6 +15,7 @@ import { shallow, ReactWrapper } from 'enzyme'; import { EuiPageHeader, EuiBasicTable } from '@elastic/eui'; import { Loading } from '../../../../shared/loading'; +import { mountWithIntl } from '../../../../test_helpers'; import { EmptyState } from '../components'; import { Curations, CurationsTable } from './curations'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/creation_mode_components/api_code_example.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/creation_mode_components/api_code_example.test.tsx index 34afa9d1e39ed..b0cf40713142a 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/creation_mode_components/api_code_example.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/creation_mode_components/api_code_example.test.tsx @@ -6,7 +6,7 @@ */ import '../../../../__mocks__/enterprise_search_url.mock'; -import { setMockValues, setMockActions } from '../../../../__mocks__/kea.mock'; +import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/creation_mode_components/paste_json_text.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/creation_mode_components/paste_json_text.test.tsx index 8b5b36094fbc6..863e87a28f40e 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/creation_mode_components/paste_json_text.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/creation_mode_components/paste_json_text.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions, rerender } from '../../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic'; import React from 'react'; @@ -13,6 +13,8 @@ import { shallow } from 'enzyme'; import { EuiTextArea, EuiButtonEmpty, EuiButton } from '@elastic/eui'; +import { rerender } from '../../../../test_helpers'; + import { Errors } from '../creation_response_components'; import { PasteJsonText, FlyoutHeader, FlyoutBody, FlyoutFooter } from './paste_json_text'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/creation_mode_components/show_creation_modes.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/creation_mode_components/show_creation_modes.test.tsx index 739580d039a36..1087e3d927559 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/creation_mode_components/show_creation_modes.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/creation_mode_components/show_creation_modes.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockActions } from '../../../../__mocks__/kea.mock'; +import { setMockActions } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/creation_mode_components/upload_json_file.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/creation_mode_components/upload_json_file.test.tsx index 7dc8952a18688..9b8820434fad8 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/creation_mode_components/upload_json_file.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/creation_mode_components/upload_json_file.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions, rerender } from '../../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic'; import React from 'react'; @@ -13,6 +13,8 @@ import { shallow } from 'enzyme'; import { EuiFilePicker, EuiButtonEmpty, EuiButton } from '@elastic/eui'; +import { rerender } from '../../../../test_helpers'; + import { Errors } from '../creation_response_components'; import { UploadJsonFile, FlyoutHeader, FlyoutBody, FlyoutFooter } from './upload_json_file'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/creation_response_components/errors.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/creation_response_components/errors.test.tsx index f03989aeaf5a3..3a3e7fd66d314 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/creation_response_components/errors.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/creation_response_components/errors.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues } from '../../../../__mocks__/kea.mock'; +import { setMockValues } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/creation_response_components/summary.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/creation_response_components/summary.test.tsx index f53f94322879c..39608c6e8f81d 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/creation_response_components/summary.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/creation_response_components/summary.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions } from '../../../../__mocks__/kea.mock'; +import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/creation_response_components/summary_sections.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/creation_response_components/summary_sections.test.tsx index 7eb9f3f46036d..7843b8bbf907b 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/creation_response_components/summary_sections.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/creation_response_components/summary_sections.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues } from '../../../../__mocks__/kea.mock'; +import { setMockValues } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/document_creation_buttons.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/document_creation_buttons.test.tsx index 7cbcc6b17e047..f293a0050eac9 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/document_creation_buttons.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/document_creation_buttons.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockActions } from '../../../__mocks__/kea.mock'; +import { setMockActions } from '../../../__mocks__/kea_logic'; import '../../__mocks__/engine_logic.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/document_creation_flyout.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/document_creation_flyout.test.tsx index 66995b8d20dfe..3dc5d445930ba 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/document_creation_flyout.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/document_creation_flyout.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions } from '../../../__mocks__/kea.mock'; +import { setMockValues, setMockActions } from '../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/document_creation_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/document_creation_logic.test.ts index 2c6cadf9a8ece..a75cb78536783 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/document_creation_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/document_creation_logic.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { LogicMounter, mockHttpValues } from '../../../__mocks__'; +import { LogicMounter, mockHttpValues } from '../../../__mocks__/kea_logic'; import dedent from 'dedent'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/components/document_creation_button.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/components/document_creation_button.test.tsx index a6ccdc180b415..e9b74a56d0e50 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/components/document_creation_button.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/components/document_creation_button.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockActions } from '../../../../__mocks__/kea.mock'; +import { setMockActions } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/document_detail.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/document_detail.test.tsx index c4563b4357134..4aade8e61b085 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/document_detail.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/document_detail.test.tsx @@ -5,13 +5,12 @@ * 2.0. */ -import { setMockValues, setMockActions } from '../../../__mocks__/kea.mock'; +import { setMockValues, setMockActions } from '../../../__mocks__/kea_logic'; +import { mockUseParams } from '../../../__mocks__/react_router'; import { unmountHandler } from '../../../__mocks__/shallow_useeffect.mock'; -import '../../../__mocks__/react_router_history.mock'; import '../../__mocks__/engine_logic.mock'; import React from 'react'; -import { useParams } from 'react-router-dom'; import { shallow } from 'enzyme'; @@ -39,7 +38,7 @@ describe('DocumentDetail', () => { setMockValues(values); setMockActions(actions); - (useParams as jest.Mock).mockImplementationOnce(() => ({ + mockUseParams.mockImplementationOnce(() => ({ documentId: '1', })); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/document_detail_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/document_detail_logic.test.ts index 565c3069788c0..a258dcd970c74 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/document_detail_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/document_detail_logic.test.ts @@ -10,7 +10,7 @@ import { mockHttpValues, mockKibanaValues, mockFlashMessageHelpers, -} from '../../../__mocks__'; +} from '../../../__mocks__/kea_logic'; import { mockEngineValues } from '../../__mocks__'; import { nextTick } from '@kbn/test/jest'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/documents.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/documents.test.tsx index 88f5b6a1c49e6..143ad3f55ff2f 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/documents.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/documents.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues } from '../../../__mocks__/kea.mock'; +import { setMockValues } from '../../../__mocks__/kea_logic'; import '../../__mocks__/engine_logic.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/documents_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/documents_logic.test.ts index c1d30a3cdd401..29b2c835f8260 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/documents_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/documents_logic.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { LogicMounter } from '../../../__mocks__/kea.mock'; +import { LogicMounter } from '../../../__mocks__/kea_logic'; import { DocumentsLogic } from './documents_logic'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/search_experience/customization_modal.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/search_experience/customization_modal.test.tsx index 332c5b822eb6d..536698ffe28f3 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/search_experience/customization_modal.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/search_experience/customization_modal.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions } from '../../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/search_experience/search_experience.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/search_experience/search_experience.test.tsx index e5f2978e5ba92..a4d1a92ee45a4 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/search_experience/search_experience.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/search_experience/search_experience.test.tsx @@ -6,7 +6,7 @@ */ import '../../../../__mocks__/enterprise_search_url.mock'; -import { setMockValues } from '../../../../__mocks__'; +import { setMockValues } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/search_experience/search_experience_content.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/search_experience/search_experience_content.test.tsx index ea111402309b4..44a6da51ec8d6 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/search_experience/search_experience_content.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/search_experience/search_experience_content.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues } from '../../../../__mocks__/kea.mock'; +import { setMockValues } from '../../../../__mocks__/kea_logic'; import { setMockSearchContextState } from './__mocks__/hooks.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_logic.test.ts index 836265a037e16..2b60193d4f7d3 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_logic.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { LogicMounter, mockHttpValues } from '../../../__mocks__'; +import { LogicMounter, mockHttpValues } from '../../../__mocks__/kea_logic'; import { nextTick } from '@kbn/test/jest'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_nav.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_nav.test.tsx index d913e3921bf1b..c2b0a6a50fd06 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_nav.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_nav.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, rerender } from '../../../__mocks__'; +import { setMockValues } from '../../../__mocks__/kea_logic'; import { mockEngineValues } from '../../__mocks__'; import React from 'react'; @@ -14,6 +14,8 @@ import { shallow } from 'enzyme'; import { EuiBadge, EuiIcon } from '@elastic/eui'; +import { rerender } from '../../../test_helpers'; + import { EngineNav } from './engine_nav'; describe('EngineNav', () => { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_router.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_router.test.tsx index 3eab209d706fa..b74c31adca438 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_router.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_router.test.tsx @@ -5,13 +5,17 @@ * 2.0. */ -import '../../../__mocks__/react_router_history.mock'; -import { mockFlashMessageHelpers, setMockValues, setMockActions } from '../../../__mocks__'; +import { + mockFlashMessageHelpers, + setMockValues, + setMockActions, +} from '../../../__mocks__/kea_logic'; +import { mockUseParams } from '../../../__mocks__/react_router'; import { unmountHandler } from '../../../__mocks__/shallow_useeffect.mock'; import { mockEngineValues } from '../../__mocks__'; import React from 'react'; -import { Switch, Redirect, useParams } from 'react-router-dom'; +import { Switch, Redirect } from 'react-router-dom'; import { shallow } from 'enzyme'; @@ -43,7 +47,7 @@ describe('EngineRouter', () => { beforeEach(() => { setMockValues(values); setMockActions(actions); - (useParams as jest.Mock).mockReturnValue({ engineName: 'some-engine' }); + mockUseParams.mockReturnValue({ engineName: 'some-engine' }); }); describe('useEffect', () => { @@ -87,7 +91,7 @@ describe('EngineRouter', () => { // any route views as they would be rendering with the wrong data. it('renders a loading component if the engine stored in state is stale', () => { setMockValues({ ...values, engineName: 'some-engine' }); - (useParams as jest.Mock).mockReturnValue({ engineName: 'some-new-engine' }); + mockUseParams.mockReturnValue({ engineName: 'some-new-engine' }); const wrapper = shallow(); expect(wrapper.find(Loading)).toHaveLength(1); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation.test.tsx index 9d1bbafc82662..b91e33d1c8a92 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockActions, setMockValues } from '../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation_logic.test.ts index 6d5c4480e45f6..1e87b3ef21f03 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation_logic.test.ts @@ -10,7 +10,7 @@ import { mockHttpValues, mockKibanaValues, mockFlashMessageHelpers, -} from '../../../__mocks__'; +} from '../../../__mocks__/kea_logic'; import { nextTick } from '@kbn/test/jest'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/components/recent_api_logs.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/components/recent_api_logs.test.tsx index 6f3ec806a438d..1281d8f23a7eb 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/components/recent_api_logs.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/components/recent_api_logs.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockActions } from '../../../../__mocks__'; +import { setMockActions } from '../../../../__mocks__/kea_logic'; import '../../../../__mocks__/shallow_useeffect.mock'; import '../../../__mocks__/engine_logic.mock'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/components/total_charts.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/components/total_charts.test.tsx index 74ce770205ffe..b20b71487307d 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/components/total_charts.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/components/total_charts.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues } from '../../../../__mocks__/kea.mock'; +import { setMockValues } from '../../../../__mocks__/kea_logic'; import '../../../__mocks__/engine_logic.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/components/total_stats.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/components/total_stats.test.tsx index 7fcda61073c5b..28a63c5d36842 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/components/total_stats.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/components/total_stats.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues } from '../../../../__mocks__/kea.mock'; +import { setMockValues } from '../../../../__mocks__/kea_logic'; import React from 'react'; 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 d2d69de72c110..a3b2f4cfd8b9f 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 @@ -6,7 +6,7 @@ */ import '../../../__mocks__/shallow_useeffect.mock'; -import { setMockValues, setMockActions } from '../../../__mocks__/kea.mock'; +import { setMockValues, setMockActions } from '../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/engine_overview_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/engine_overview_logic.test.ts index b790edef43cc4..c9c1defd46032 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/engine_overview_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/engine_overview_logic.test.ts @@ -5,7 +5,11 @@ * 2.0. */ -import { LogicMounter, mockHttpValues, mockFlashMessageHelpers } from '../../../__mocks__'; +import { + LogicMounter, + mockHttpValues, + mockFlashMessageHelpers, +} from '../../../__mocks__/kea_logic'; jest.mock('../engine', () => ({ EngineLogic: { values: { engineName: 'some-engine' } }, diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/empty_state.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/empty_state.test.tsx index 222041c9f85a3..159a986096ae2 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/empty_state.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/empty_state.test.tsx @@ -5,8 +5,7 @@ * 2.0. */ -import '../../../../__mocks__/kea.mock'; -import { setMockValues, mockTelemetryActions } from '../../../../__mocks__'; +import { setMockValues, mockTelemetryActions } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/header.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/header.test.tsx index 8cb26713cb840..9b245a468b083 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/header.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/header.test.tsx @@ -6,7 +6,7 @@ */ import '../../../../__mocks__/enterprise_search_url.mock'; -import { mockTelemetryActions } from '../../../../__mocks__'; +import { mockTelemetryActions } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/tables/engine_link_helpers.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/tables/engine_link_helpers.test.tsx index 5d91c724068e7..1ddf6e40ce1ff 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/tables/engine_link_helpers.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/tables/engine_link_helpers.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { mockKibanaValues, mockTelemetryActions } from '../../../../../__mocks__'; +import { mockKibanaValues, mockTelemetryActions } from '../../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/tables/engines_table.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/tables/engines_table.test.tsx index 8d3b4b2a5e6ca..b9369d019a2f8 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/tables/engines_table.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/tables/engines_table.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { mountWithIntl, setMockValues } from '../../../../../__mocks__'; +import { setMockValues } from '../../../../../__mocks__/kea_logic'; import '../../../../../__mocks__/enterprise_search_url.mock'; import './__mocks__/engines_logic.mock'; @@ -15,6 +15,8 @@ import { shallow } from 'enzyme'; import { EuiBasicTable } from '@elastic/eui'; +import { mountWithIntl } from '../../../../../test_helpers'; + import { EngineDetails } from '../../../engine/types'; import { EnginesTable } from './engines_table'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/tables/meta_engines_table.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/tables/meta_engines_table.test.tsx index 430539c10bbf3..fb258e1e3be8c 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/tables/meta_engines_table.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/tables/meta_engines_table.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { mountWithIntl, setMockValues } from '../../../../../__mocks__'; +import { setMockValues } from '../../../../../__mocks__/kea_logic'; import '../../../../../__mocks__/enterprise_search_url.mock'; import './__mocks__/engines_logic.mock'; @@ -15,6 +15,8 @@ import { shallow } from 'enzyme'; import { EuiBasicTable } from '@elastic/eui'; +import { mountWithIntl } from '../../../../../test_helpers'; + import { EngineDetails } from '../../../engine/types'; import { MetaEnginesTable } from './meta_engines_table'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/tables/meta_engines_table_expanded_row.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/tables/meta_engines_table_expanded_row.test.tsx index dcaa1a2b7c246..26c8c0fddcd11 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/tables/meta_engines_table_expanded_row.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/tables/meta_engines_table_expanded_row.test.tsx @@ -5,14 +5,14 @@ * 2.0. */ -import { mountWithIntl } from '../../../../../__mocks__'; - import React from 'react'; import { shallow } from 'enzyme'; import { EuiBasicTable, EuiHealth } from '@elastic/eui'; +import { mountWithIntl } from '../../../../../test_helpers'; + import { EngineDetails } from '../../../engine/types'; import { MetaEnginesTableExpandedRow } from './meta_engines_table_expanded_row'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/tables/meta_engines_table_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/tables/meta_engines_table_logic.test.ts index de1902c7cf748..3c0b9c4dc33f6 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/tables/meta_engines_table_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/tables/meta_engines_table_logic.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { LogicMounter } from '../../../../../__mocks__'; +import { LogicMounter } from '../../../../../__mocks__/kea_logic'; import { mockRecursivelyFetchEngines } from '../../../../__mocks__/recursively_fetch_engines.mock'; import { EngineDetails } from '../../../engine/types'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/tables/test_helpers/shared_columns.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/tables/test_helpers/shared_columns.tsx index 97e2057cea2d9..b46dfa7e19dd9 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/tables/test_helpers/shared_columns.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/tables/test_helpers/shared_columns.tsx @@ -5,13 +5,15 @@ * 2.0. */ -import { setMockValues, rerender } from '../../../../../../__mocks__'; +import { setMockValues } from '../../../../../../__mocks__/kea_logic'; import '../__mocks__/engines_logic.mock'; import { ShallowWrapper } from 'enzyme'; import { EuiBasicTable, EuiButtonIcon } from '@elastic/eui'; +import { rerender } from '../../../../../../test_helpers'; + import { EnginesLogic } from '../../../../engines'; import * as engineLinkHelpers from '../engine_link_helpers'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/engines_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/engines_logic.test.ts index a67e5bb9ae7dc..eb95d1ce148da 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/engines_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/engines_logic.test.ts @@ -5,7 +5,11 @@ * 2.0. */ -import { LogicMounter, mockHttpValues, mockFlashMessageHelpers } from '../../../__mocks__'; +import { + LogicMounter, + mockHttpValues, + mockFlashMessageHelpers, +} from '../../../__mocks__/kea_logic'; import { nextTick } from '@kbn/test/jest'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/engines_overview.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/engines_overview.test.tsx index b326a7d3ee075..27fe65fe518eb 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/engines_overview.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/engines_overview.test.tsx @@ -6,12 +6,14 @@ */ import '../../../__mocks__/shallow_useeffect.mock'; -import { setMockValues, setMockActions, rerender } from '../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../__mocks__/kea_logic'; import React from 'react'; import { shallow, ShallowWrapper } from 'enzyme'; +import { rerender } from '../../../test_helpers'; + import { LoadingState, EmptyState } from './components'; import { EnginesTable } from './components/tables/engines_table'; import { MetaEnginesTable } from './components/tables/meta_engines_table'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/layout/kibana_header_actions.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/layout/kibana_header_actions.test.tsx index 096d858cd1191..d25e6ab27b099 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/layout/kibana_header_actions.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/layout/kibana_header_actions.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues } from '../../../__mocks__'; +import { setMockValues } from '../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/components/log_retention_callout.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/components/log_retention_callout.test.tsx index fe022391d76b4..c6ccdc78b16f3 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/components/log_retention_callout.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/components/log_retention_callout.test.tsx @@ -6,7 +6,7 @@ */ import '../../../../__mocks__/shallow_useeffect.mock'; -import { setMockValues, setMockActions, mountWithIntl } from '../../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic'; import React from 'react'; @@ -14,7 +14,9 @@ import { shallow } from 'enzyme'; import { EuiCallOut, EuiLink } from '@elastic/eui'; -import { LogRetentionOptions } from '../'; +import { mountWithIntl } from '../../../../test_helpers'; + +import { LogRetentionOptions } from '../index'; import { LogRetentionCallout } from './'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/components/log_retention_tooltip.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/components/log_retention_tooltip.test.tsx index 6b5693e4c301e..db5f058b28015 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/components/log_retention_tooltip.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/components/log_retention_tooltip.test.tsx @@ -6,7 +6,7 @@ */ import '../../../../__mocks__/shallow_useeffect.mock'; -import { setMockValues, setMockActions } from '../../../../__mocks__/kea.mock'; +import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/log_retention_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/log_retention_logic.test.ts index 57f3f46fed92e..4e2382c23edbd 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/log_retention_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/log_retention_logic.test.ts @@ -5,7 +5,11 @@ * 2.0. */ -import { LogicMounter, mockHttpValues, mockFlashMessageHelpers } from '../../../__mocks__'; +import { + LogicMounter, + mockHttpValues, + mockFlashMessageHelpers, +} from '../../../__mocks__/kea_logic'; import { nextTick } from '@kbn/test/jest'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/messaging/log_retention_message.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/messaging/log_retention_message.test.tsx index cd71e37108927..ab221879367b3 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/messaging/log_retention_message.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/messaging/log_retention_message.test.tsx @@ -5,12 +5,14 @@ * 2.0. */ -import { setMockValues, mountWithIntl } from '../../../../__mocks__'; +import { setMockValues } from '../../../../__mocks__/kea_logic'; import React from 'react'; import { shallow } from 'enzyme'; +import { mountWithIntl } from '../../../../test_helpers'; + import { LogRetentionOptions } from '../types'; import { LogRetentionMessage } from './'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/meta_engine_creation/meta_engine_creation.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/meta_engine_creation/meta_engine_creation.test.tsx index a30f5bf77efad..fe7ea2d959289 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/meta_engine_creation/meta_engine_creation.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/meta_engine_creation/meta_engine_creation.test.tsx @@ -6,7 +6,7 @@ */ import '../../../__mocks__/shallow_useeffect.mock'; -import { setMockActions, setMockValues } from '../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/meta_engine_creation/meta_engine_creation_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/meta_engine_creation/meta_engine_creation_logic.test.ts index d8968316d1b72..137a8afc5c4fe 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/meta_engine_creation/meta_engine_creation_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/meta_engine_creation/meta_engine_creation_logic.test.ts @@ -10,7 +10,7 @@ import { mockHttpValues, mockFlashMessageHelpers, mockKibanaValues, -} from '../../../__mocks__'; +} from '../../../__mocks__/kea_logic'; import { nextTick } from '@kbn/test/jest'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/multi_input_rows/multi_input_rows.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/multi_input_rows/multi_input_rows.test.tsx index 0b6f8b4a6d3d4..3b8e1c96ff504 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/multi_input_rows/multi_input_rows.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/multi_input_rows/multi_input_rows.test.tsx @@ -5,13 +5,15 @@ * 2.0. */ -import { setMockActions, setMockValues, rerender } from '../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../__mocks__/kea_logic'; import '../../../__mocks__/shallow_useeffect.mock'; import React from 'react'; import { shallow } from 'enzyme'; +import { rerender } from '../../../test_helpers'; + import { InputRow } from './input_row'; jest.mock('./multi_input_rows_logic', () => ({ diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/multi_input_rows/multi_input_rows_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/multi_input_rows/multi_input_rows_logic.test.ts index 0e2d28a6fc3e1..de439349bd15f 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/multi_input_rows/multi_input_rows_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/multi_input_rows/multi_input_rows_logic.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { LogicMounter } from '../../../__mocks__'; +import { LogicMounter } from '../../../__mocks__/kea_logic'; import { Logic } from 'kea'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/query_tester/query_tester.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/query_tester/query_tester.test.tsx index 160be70cbbfc9..a9e2b7129c781 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/query_tester/query_tester.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/query_tester/query_tester.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions } from '../../../__mocks__/kea.mock'; +import { setMockValues, setMockActions } from '../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/boosts/boost_item_content/boost_item_content.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/boosts/boost_item_content/boost_item_content.test.tsx index e21f46c6748dd..794c644f3d40b 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/boosts/boost_item_content/boost_item_content.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/boosts/boost_item_content/boost_item_content.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockActions } from '../../../../../__mocks__/kea.mock'; +import { setMockActions } from '../../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/boosts/boost_item_content/functional_boost_form.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/boosts/boost_item_content/functional_boost_form.test.tsx index feb4328e5adea..4a540e09287ed 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/boosts/boost_item_content/functional_boost_form.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/boosts/boost_item_content/functional_boost_form.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockActions } from '../../../../../__mocks__/kea.mock'; +import { setMockActions } from '../../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/boosts/boost_item_content/proximity_boost_form.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/boosts/boost_item_content/proximity_boost_form.test.tsx index 0ed914abb3ab5..776a21c5acb1b 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/boosts/boost_item_content/proximity_boost_form.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/boosts/boost_item_content/proximity_boost_form.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockActions } from '../../../../../__mocks__/kea.mock'; +import { setMockActions } from '../../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/boosts/boost_item_content/value_boost_form.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/boosts/boost_item_content/value_boost_form.test.tsx index 6f9284891e711..292be35055e37 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/boosts/boost_item_content/value_boost_form.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/boosts/boost_item_content/value_boost_form.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockActions } from '../../../../../__mocks__/kea.mock'; +import { setMockActions } from '../../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/boosts/boosts.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/boosts/boosts.test.tsx index c82efa906f676..a7c7002fbf273 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/boosts/boosts.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/boosts/boosts.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockActions } from '../../../../__mocks__/kea.mock'; +import { setMockActions } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning.test.tsx index 574d2ae02af99..092740ac5d3cc 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockActions, setMockValues } from '../../../__mocks__/kea.mock'; +import { setMockActions, setMockValues } from '../../../__mocks__/kea_logic'; import '../../../__mocks__/shallow_useeffect.mock'; import '../../__mocks__/engine_logic.mock'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_callouts.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_callouts.test.tsx index 8ab706f5953fb..8384d07938678 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_callouts.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_callouts.test.tsx @@ -6,7 +6,7 @@ */ import '../../__mocks__/engine_logic.mock'; -import { setMockValues } from '../../../__mocks__/kea.mock'; +import { setMockValues } from '../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_form/relevance_tuning_form.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_form/relevance_tuning_form.test.tsx index a1a241b8856a5..d4052f23cfca4 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_form/relevance_tuning_form.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_form/relevance_tuning_form.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions } from '../../../../__mocks__/kea.mock'; +import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_form/relevance_tuning_item_content/text_search_toggle.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_form/relevance_tuning_item_content/text_search_toggle.test.tsx index f2d4f9c20a58d..85cf4af7a7b76 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_form/relevance_tuning_item_content/text_search_toggle.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_form/relevance_tuning_item_content/text_search_toggle.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockActions } from '../../../../../__mocks__/kea.mock'; +import { setMockActions } from '../../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_form/relevance_tuning_item_content/weight_slider.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_form/relevance_tuning_item_content/weight_slider.test.tsx index 21a112a4ea988..49c02ef8e94f2 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_form/relevance_tuning_item_content/weight_slider.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_form/relevance_tuning_item_content/weight_slider.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockActions } from '../../../../../__mocks__/kea.mock'; +import { setMockActions } from '../../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_layout.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_layout.test.tsx index 6f4333d94919b..20b1a16879234 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_layout.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_layout.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockActions, setMockValues } from '../../../__mocks__/kea.mock'; +import { setMockActions, setMockValues } from '../../../__mocks__/kea_logic'; import '../../__mocks__/engine_logic.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_logic.test.ts index 97030e08e2a9f..1d143ed0ca938 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_logic.test.ts @@ -5,7 +5,11 @@ * 2.0. */ -import { LogicMounter, mockFlashMessageHelpers, mockHttpValues } from '../../../__mocks__'; +import { + LogicMounter, + mockFlashMessageHelpers, + mockHttpValues, +} from '../../../__mocks__/kea_logic'; import { mockEngineValues, mockEngineActions } from '../../__mocks__'; import { nextTick } from '@kbn/test/jest'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_preview.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_preview.test.tsx index ec6458a14b346..b39faa6029436 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_preview.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_preview.test.tsx @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { setMockActions, setMockValues } from '../../../__mocks__/kea.mock'; +import { setMockActions, setMockValues } from '../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result/result.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result/result.test.tsx index 333cefecb99c8..1e361f113d883 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result/result.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result/result.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { mockKibanaValues } from '../../../__mocks__'; +import { mockKibanaValues } from '../../../__mocks__/kea_logic'; import React from 'react'; import { DraggableProvidedDragHandleProps } from 'react-beautiful-dnd'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/query_performance/query_performance.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/query_performance/query_performance.test.tsx index 0c62b783a47ff..604d94f915439 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/query_performance/query_performance.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/query_performance/query_performance.test.tsx @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { setMockValues } from '../../../../__mocks__/kea.mock'; +import { setMockValues } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings.test.tsx index dd99dc6c505da..ec521b4959535 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions } from '../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../__mocks__/kea_logic'; import '../../../__mocks__/shallow_useeffect.mock'; import '../../__mocks__/engine_logic.mock'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_logic.test.ts index 6522d84aef156..5ce6fd9328917 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_logic.test.ts @@ -5,8 +5,11 @@ * 2.0. */ -import { LogicMounter, mockFlashMessageHelpers, mockHttpValues } from '../../../__mocks__'; - +import { + LogicMounter, + mockFlashMessageHelpers, + mockHttpValues, +} from '../../../__mocks__/kea_logic'; import { mockEngineValues } from '../../__mocks__'; import { omit } from 'lodash'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_table/disabled_fields_body.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_table/disabled_fields_body.test.tsx index db87ac20a4223..580bb4db76389 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_table/disabled_fields_body.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_table/disabled_fields_body.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues } from '../../../../__mocks__'; +import { setMockValues } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_table/non_text_fields_body.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_table/non_text_fields_body.test.tsx index c99b8644812b9..8abb716183a9f 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_table/non_text_fields_body.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_table/non_text_fields_body.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions } from '../../../../__mocks__/kea.mock'; +import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_table/result_settings_table.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_table/result_settings_table.test.tsx index 151d436e59ea2..332b4a31895f4 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_table/result_settings_table.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_table/result_settings_table.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues } from '../../../../__mocks__/kea.mock'; +import { setMockValues } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_table/text_fields_body.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_table/text_fields_body.test.tsx index 7be58a387fa69..6f2f4c9f9acbf 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_table/text_fields_body.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_table/text_fields_body.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions } from '../../../../__mocks__/kea.mock'; +import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/sample_response/sample_response.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/sample_response/sample_response.test.tsx index e324150a2d52a..964e466582d60 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/sample_response/sample_response.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/sample_response/sample_response.test.tsx @@ -6,7 +6,7 @@ */ import '../../../../__mocks__/shallow_useeffect.mock'; -import { setMockActions, setMockValues } from '../../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/sample_response/sample_response_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/sample_response/sample_response_logic.test.ts index 11f8a1089af9b..426934b95388e 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/sample_response/sample_response_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/sample_response/sample_response_logic.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { LogicMounter, mockHttpValues } from '../../../../__mocks__'; +import { LogicMounter, mockHttpValues } from '../../../../__mocks__/kea_logic'; import '../../../__mocks__/engine_logic.mock'; import { nextTick } from '@kbn/test/jest'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/role_mappings/role_mapping.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/role_mappings/role_mapping.test.tsx index b7ba254cc3d7d..0b7d4255fc323 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/role_mappings/role_mapping.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/role_mappings/role_mapping.test.tsx @@ -5,9 +5,10 @@ * 2.0. */ +import '../../../__mocks__/react_router'; import '../../../__mocks__/shallow_useeffect.mock'; import { DEFAULT_INITIAL_APP_DATA } from '../../../../../common/__mocks__'; -import { setMockActions, setMockValues } from '../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../__mocks__/kea_logic'; import { engines } from '../../__mocks__/engines.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/role_mappings/role_mappings.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/role_mappings/role_mappings.test.tsx index 9559df2c1f981..d7ce8053c71f0 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/role_mappings/role_mappings.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/role_mappings/role_mappings.test.tsx @@ -6,7 +6,7 @@ */ import '../../../__mocks__/shallow_useeffect.mock'; -import { setMockActions, setMockValues } from '../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/role_mappings/role_mappings_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/role_mappings/role_mappings_logic.test.ts index 0faafcc7a299d..87e6ee62460fa 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/role_mappings/role_mappings_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/role_mappings/role_mappings_logic.test.ts @@ -5,8 +5,11 @@ * 2.0. */ -import { mockFlashMessageHelpers, mockHttpValues } from '../../../__mocks__'; -import { LogicMounter } from '../../../__mocks__/kea.mock'; +import { + LogicMounter, + mockFlashMessageHelpers, + mockHttpValues, +} from '../../../__mocks__/kea_logic'; import { engines } from '../../__mocks__/engines.mock'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/sample_engine_creation_cta/sample_engine_creation_cta.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/sample_engine_creation_cta/sample_engine_creation_cta.test.tsx index 992afe4356a07..ac25e887c2de0 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/sample_engine_creation_cta/sample_engine_creation_cta.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/sample_engine_creation_cta/sample_engine_creation_cta.test.tsx @@ -6,7 +6,7 @@ */ import '../../../__mocks__/enterprise_search_url.mock'; -import { setMockActions, setMockValues } from '../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/sample_engine_creation_cta/sample_engine_creation_cta_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/sample_engine_creation_cta/sample_engine_creation_cta_logic.test.ts index 740c4df697d68..3400361144ca4 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/sample_engine_creation_cta/sample_engine_creation_cta_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/sample_engine_creation_cta/sample_engine_creation_cta_logic.test.ts @@ -10,7 +10,7 @@ import { mockHttpValues, mockKibanaValues, mockFlashMessageHelpers, -} from '../../../__mocks__'; +} from '../../../__mocks__/kea_logic'; import { nextTick } from '@kbn/test/jest'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/components/meta_engines_conflicts_table.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/components/meta_engines_conflicts_table.test.tsx index eb40d70e13ff8..5d2b5c8a8eacf 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/components/meta_engines_conflicts_table.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/components/meta_engines_conflicts_table.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues } from '../../../../__mocks__'; +import { setMockValues } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/components/meta_engines_schema_table.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/components/meta_engines_schema_table.test.tsx index 7d377d5a92714..e4235336b1d4b 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/components/meta_engines_schema_table.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/components/meta_engines_schema_table.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues } from '../../../../__mocks__'; +import { setMockValues } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/components/schema_callouts.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/components/schema_callouts.test.tsx index 5bb08a6c8859a..e259e67dd2e4e 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/components/schema_callouts.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/components/schema_callouts.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions } from '../../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic'; import '../../../__mocks__/engine_logic.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/components/schema_table.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/components/schema_table.test.tsx index c8b0bb7ddbac5..366558556c6f9 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/components/schema_table.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/components/schema_table.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions } from '../../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/reindex_job/reindex_job.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/reindex_job/reindex_job.test.tsx index 1755fbea5fb7b..e76ab60005231 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/reindex_job/reindex_job.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/reindex_job/reindex_job.test.tsx @@ -5,13 +5,12 @@ * 2.0. */ -import { setMockValues, setMockActions } from '../../../../__mocks__'; -import '../../../../__mocks__/react_router_history.mock'; +import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic'; +import { mockUseParams } from '../../../../__mocks__/react_router'; import '../../../../__mocks__/shallow_useeffect.mock'; import '../../../__mocks__/engine_logic.mock'; import React from 'react'; -import { useParams } from 'react-router-dom'; import { shallow } from 'enzyme'; @@ -38,7 +37,7 @@ describe('ReindexJob', () => { }; beforeEach(() => { - (useParams as jest.Mock).mockReturnValueOnce({ reindexJobId: 'abc1234567890' }); + mockUseParams.mockReturnValueOnce({ reindexJobId: 'abc1234567890' }); setMockValues(values); setMockActions(actions); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/reindex_job/reindex_job_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/reindex_job/reindex_job_logic.test.ts index b872ad3c914c6..f01c735aeca8e 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/reindex_job/reindex_job_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/reindex_job/reindex_job_logic.test.ts @@ -5,7 +5,11 @@ * 2.0. */ -import { LogicMounter, mockFlashMessageHelpers, mockHttpValues } from '../../../../__mocks__'; +import { + LogicMounter, + mockFlashMessageHelpers, + mockHttpValues, +} from '../../../../__mocks__/kea_logic'; import '../../../__mocks__/engine_logic.mock'; import { nextTick } from '@kbn/test/jest'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/schema_base_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/schema_base_logic.test.ts index 2f5788278aa0b..684780d72a275 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/schema_base_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/schema_base_logic.test.ts @@ -5,7 +5,11 @@ * 2.0. */ -import { LogicMounter, mockFlashMessageHelpers, mockHttpValues } from '../../../__mocks__'; +import { + LogicMounter, + mockFlashMessageHelpers, + mockHttpValues, +} from '../../../__mocks__/kea_logic'; import '../../__mocks__/engine_logic.mock'; import { nextTick } from '@kbn/test/jest'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/schema_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/schema_logic.test.ts index 123f62af4eeba..7687296cf9f83 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/schema_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/schema_logic.test.ts @@ -5,7 +5,11 @@ * 2.0. */ -import { LogicMounter, mockFlashMessageHelpers, mockHttpValues } from '../../../__mocks__'; +import { + LogicMounter, + mockFlashMessageHelpers, + mockHttpValues, +} from '../../../__mocks__/kea_logic'; import { mockEngineActions } from '../../__mocks__/engine_logic.mock'; import { nextTick } from '@kbn/test/jest'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/schema_meta_engine_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/schema_meta_engine_logic.test.ts index f265fb2d74113..4e56b26902142 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/schema_meta_engine_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/schema_meta_engine_logic.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { LogicMounter } from '../../../__mocks__'; +import { LogicMounter } from '../../../__mocks__/kea_logic'; import { SchemaType } from '../../../shared/schema/types'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/schema_router.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/schema_router.test.tsx index 13a94c666509b..f1713c36045e9 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/schema_router.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/schema_router.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, rerender } from '../../../__mocks__'; +import { setMockValues } from '../../../__mocks__/kea_logic'; import '../../__mocks__/engine_logic.mock'; import React from 'react'; @@ -13,6 +13,8 @@ import { Route, Switch } from 'react-router-dom'; import { shallow } from 'enzyme'; +import { rerender } from '../../../test_helpers'; + import { ReindexJob } from './reindex_job'; import { Schema, MetaEngineSchema } from './views'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/views/meta_engine_schema.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/views/meta_engine_schema.test.tsx index b1322c148b577..1d677ad08db43 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/views/meta_engine_schema.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/views/meta_engine_schema.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions } from '../../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic'; import '../../../../__mocks__/shallow_useeffect.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/views/schema.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/views/schema.test.tsx index 23d1480e5dca9..91ec8eda55fc3 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/views/schema.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/views/schema.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions } from '../../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic'; import '../../../../__mocks__/shallow_useeffect.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/search/search_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/search/search_logic.test.ts index 784ebd0aad0cb..c0d81f87e3e02 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/search/search_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/search/search_logic.test.ts @@ -6,8 +6,11 @@ */ import '../../__mocks__/engine_logic.mock'; - -import { LogicMounter, mockHttpValues, mockFlashMessageHelpers } from '../../../__mocks__'; +import { + LogicMounter, + mockHttpValues, + mockFlashMessageHelpers, +} from '../../../__mocks__/kea_logic'; import { nextTick } from '@kbn/test/jest'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/search_ui/components/search_ui_form.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/search_ui/components/search_ui_form.test.tsx index 82b925f57f2df..944c99f7c61c2 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/search_ui/components/search_ui_form.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/search_ui/components/search_ui_form.test.tsx @@ -9,7 +9,7 @@ jest.mock('../utils', () => ({ generatePreviewUrl: jest.fn(), })); -import { setMockValues, setMockActions } from '../../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/search_ui/components/search_ui_graphic.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/search_ui/components/search_ui_graphic.test.tsx index 0326cef9a2455..056543fb5e748 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/search_ui/components/search_ui_graphic.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/search_ui/components/search_ui_graphic.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues } from '../../../../__mocks__'; +import { setMockValues } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/search_ui/search_ui.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/search_ui/search_ui.test.tsx index 34c0669cc476e..edec376dd3edd 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/search_ui/search_ui.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/search_ui/search_ui.test.tsx @@ -8,7 +8,7 @@ import '../../../__mocks__/shallow_useeffect.mock'; import '../../__mocks__/engine_logic.mock'; -import { setMockActions } from '../../../__mocks__'; +import { setMockActions } from '../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/search_ui/search_ui_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/search_ui/search_ui_logic.test.ts index 2e29ac0d398a6..f615f9a4e2c72 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/search_ui/search_ui_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/search_ui/search_ui_logic.test.ts @@ -5,8 +5,11 @@ * 2.0. */ -import { LogicMounter, mockFlashMessageHelpers, mockHttpValues } from '../../../__mocks__'; - +import { + LogicMounter, + mockFlashMessageHelpers, + mockHttpValues, +} from '../../../__mocks__/kea_logic'; import { mockEngineValues } from '../../__mocks__'; import { nextTick } from '@kbn/test/jest'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/log_retention_confirmation_modal.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/log_retention_confirmation_modal.test.tsx index 494517a438372..fc20a9dbc5519 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/log_retention_confirmation_modal.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/log_retention_confirmation_modal.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockActions, setMockValues } from '../../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/log_retention_panel.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/log_retention_panel.test.tsx index aee23e61e76fe..3f6bbe4307b57 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/log_retention_panel.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/log_retention_panel.test.tsx @@ -6,7 +6,7 @@ */ import '../../../../__mocks__/shallow_useeffect.mock'; -import { setMockActions, setMockValues } from '../../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/components/add_source_engines_button.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/components/add_source_engines_button.test.tsx index 43a4682849c78..fb214b267038f 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/components/add_source_engines_button.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/components/add_source_engines_button.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockActions } from '../../../../__mocks__'; +import { setMockActions } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/components/add_source_engines_modal.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/components/add_source_engines_modal.test.tsx index 19c2f72ed6f52..b02a21ac45aed 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/components/add_source_engines_modal.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/components/add_source_engines_modal.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockActions, setMockValues } from '../../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/components/source_engines_table.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/components/source_engines_table.test.tsx index 895c7ab35e86a..7638db403191a 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/components/source_engines_table.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/components/source_engines_table.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { mountWithIntl, setMockActions, setMockValues } from '../../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../../__mocks__/kea_logic'; import React from 'react'; @@ -13,6 +13,8 @@ import { shallow } from 'enzyme'; import { EuiInMemoryTable, EuiButtonIcon } from '@elastic/eui'; +import { mountWithIntl } from '../../../../test_helpers'; + import { SourceEnginesTable } from './source_engines_table'; describe('SourceEnginesTable', () => { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/source_engines.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/source_engines.test.tsx index 8cfcaeec97b87..9d2fe653150c3 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/source_engines.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/source_engines.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockActions, setMockValues } from '../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../__mocks__/kea_logic'; import '../../../__mocks__/shallow_useeffect.mock'; import '../../__mocks__/engine_logic.mock'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/source_engines_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/source_engines_logic.test.ts index 49886f1257a58..c39a25276a43c 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/source_engines_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/source_engines_logic.test.ts @@ -5,7 +5,11 @@ * 2.0. */ -import { LogicMounter, mockFlashMessageHelpers, mockHttpValues } from '../../../__mocks__'; +import { + LogicMounter, + mockFlashMessageHelpers, + mockHttpValues, +} from '../../../__mocks__/kea_logic'; import { mockRecursivelyFetchEngines } from '../../__mocks__'; import '../../__mocks__/engine_logic.mock'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/synonyms/components/synonym_card.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/synonyms/components/synonym_card.test.tsx index ccb28a86d67c9..7a1ba289865ee 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/synonyms/components/synonym_card.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/synonyms/components/synonym_card.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockActions } from '../../../../__mocks__'; +import { setMockActions } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/synonyms/components/synonym_modal.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/synonyms/components/synonym_modal.test.tsx index dc2c6424bc2f9..15b74d1cdbca9 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/synonyms/components/synonym_modal.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/synonyms/components/synonym_modal.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions } from '../../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/synonyms/synonyms.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/synonyms/synonyms.test.tsx index 7fb3745eb158e..c8f65c4bdbc6c 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/synonyms/synonyms.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/synonyms/synonyms.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions, rerender } from '../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../__mocks__/kea_logic'; import '../../../__mocks__/shallow_useeffect.mock'; import '../../__mocks__/engine_logic.mock'; @@ -16,6 +16,7 @@ import { shallow } from 'enzyme'; import { EuiPageHeader, EuiButton, EuiPagination } from '@elastic/eui'; import { Loading } from '../../../shared/loading'; +import { rerender } from '../../../test_helpers'; import { SynonymCard, SynonymModal, EmptyState } from './components'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/synonyms/synonyms_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/synonyms/synonyms_logic.test.ts index 037f3d1e6912a..630a069d0c5e8 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/synonyms/synonyms_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/synonyms/synonyms_logic.test.ts @@ -5,7 +5,11 @@ * 2.0. */ -import { LogicMounter, mockHttpValues, mockFlashMessageHelpers } from '../../../__mocks__'; +import { + LogicMounter, + mockHttpValues, + mockFlashMessageHelpers, +} from '../../../__mocks__/kea_logic'; import '../../__mocks__/engine_logic.mock'; import { nextTick } from '@kbn/test/jest'; 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 08aab7af164e3..4d8ff80326715 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 @@ -6,19 +6,21 @@ */ import { DEFAULT_INITIAL_APP_DATA } from '../../../common/__mocks__'; -import { setMockValues, rerender } from '../__mocks__'; +import { setMockValues } from '../__mocks__/kea_logic'; +import { mockUseRouteMatch } from '../__mocks__/react_router'; import '../__mocks__/shallow_useeffect.mock'; import '../__mocks__/enterprise_search_url.mock'; -import '../__mocks__/react_router_history.mock'; import React from 'react'; -import { Redirect, useRouteMatch } from 'react-router-dom'; +import { Redirect } from 'react-router-dom'; import { shallow, ShallowWrapper } from 'enzyme'; import { Layout, SideNav, SideNavLink } from '../shared/layout'; +import { rerender } from '../test_helpers'; + jest.mock('./app_logic', () => ({ AppLogic: jest.fn() })); import { AppLogic } from './app_logic'; @@ -184,14 +186,14 @@ describe('AppSearchNav', () => { const getEnginesLink = (wrapper: ShallowWrapper) => wrapper.find(SideNavLink).dive(); it('does not render the engine subnav on top-level routes', () => { - (useRouteMatch as jest.Mock).mockReturnValueOnce(false); + mockUseRouteMatch.mockReturnValueOnce(false); const wrapper = shallow(); expect(getEnginesLink(wrapper).find(EngineNav)).toHaveLength(0); }); it('renders the engine subnav if currently on an engine route', () => { - (useRouteMatch as jest.Mock).mockReturnValueOnce(true); + mockUseRouteMatch.mockReturnValueOnce(true); const wrapper = shallow(); expect(getEnginesLink(wrapper).find(EngineNav)).toHaveLength(1); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/utils/encode_path_params/index.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/utils/encode_path_params/index.test.ts index 88863e83f9b67..f7464d1861265 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/utils/encode_path_params/index.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/utils/encode_path_params/index.test.ts @@ -5,8 +5,7 @@ * 2.0. */ -import '../../../__mocks__/react_router_history.mock'; -import { useParams } from 'react-router-dom'; +import { mockUseParams } from '../../../__mocks__/react_router'; import { encodePathParams, generateEncodedPath, useDecodedParams } from './'; @@ -38,7 +37,7 @@ describe('generateEncodedPath', () => { describe('useDecodedParams', () => { it('decodeURIComponent()s all object values from useParams()', () => { - (useParams as jest.Mock).mockReturnValue({ + mockUseParams.mockReturnValue({ someValue: 'hello%20world%3F%3F%3F', anotherValue: 'test!%40%23%24%25%5E%26*%5B%5D%2F%7C%3B%3A%22%3C%3E~%60', }); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/utils/formatted_date_time/index.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/utils/formatted_date_time/index.test.tsx index 5137a60ffe59d..47d1fe6b69d56 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/utils/formatted_date_time/index.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/utils/formatted_date_time/index.test.tsx @@ -5,10 +5,10 @@ * 2.0. */ -import { mountWithIntl } from '../../../__mocks__'; - import React from 'react'; +import { mountWithIntl } from '../../../test_helpers'; + import { FormattedDateTime } from './'; describe('FormattedDateTime', () => { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/utils/recursively_fetch_engines/index.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/utils/recursively_fetch_engines/index.test.ts index 104f98e45a5f5..a73dd075115ee 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/utils/recursively_fetch_engines/index.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/utils/recursively_fetch_engines/index.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { mockFlashMessageHelpers, mockHttpValues } from '../../../__mocks__'; +import { mockFlashMessageHelpers, mockHttpValues } from '../../../__mocks__/kea_logic'; import { nextTick } from '@kbn/test/jest'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search/components/license_callout/license_callout.test.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search/components/license_callout/license_callout.test.tsx index 26892f7cec7ae..0c77a0fbf6f5a 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search/components/license_callout/license_callout.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search/components/license_callout/license_callout.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues } from '../../../__mocks__'; +import { setMockValues } from '../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search/components/product_card/product_card.test.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search/components/product_card/product_card.test.tsx index 8631e6e2a51d4..9d54a9f1725e9 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search/components/product_card/product_card.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search/components/product_card/product_card.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, mockTelemetryActions } from '../../../__mocks__'; +import { setMockValues, mockTelemetryActions } from '../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search/components/product_selector/product_selector.test.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search/components/product_selector/product_selector.test.tsx index 9c0f7c2bac94b..90e16fe2d22fa 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search/components/product_selector/product_selector.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search/components/product_selector/product_selector.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues } from '../../../__mocks__/kea.mock'; +import { setMockValues } from '../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search/components/trial_callout/trial_callout.test.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search/components/trial_callout/trial_callout.test.tsx index 2ed2f9e43e9c4..72958acacb034 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search/components/trial_callout/trial_callout.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search/components/trial_callout/trial_callout.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues } from '../../../__mocks__'; +import { setMockValues } from '../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search/index.test.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search/index.test.tsx index 2d8dbd55f4366..fbb3e58f198a7 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search/index.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search/index.test.tsx @@ -5,12 +5,14 @@ * 2.0. */ -import { setMockValues, rerender } from '../__mocks__'; +import { setMockValues } from '../__mocks__/kea_logic'; import React from 'react'; import { shallow } from 'enzyme'; +import { rerender } from '../test_helpers'; + import { ErrorConnecting } from './components/error_connecting'; import { ProductSelector } from './components/product_selector'; import { SetupGuide } from './components/setup_guide'; diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/error_state/error_state_prompt.test.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/error_state/error_state_prompt.test.tsx index d9d31f5a45d4b..e8f0816de5225 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/error_state/error_state_prompt.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/error_state/error_state_prompt.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import '../../__mocks__/kea.mock'; +import '../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/flash_messages.test.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/flash_messages.test.tsx index 289dcc0137cb8..6f4f3853fa8c9 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/flash_messages.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/flash_messages.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions } from '../../__mocks__/kea.mock'; +import { setMockValues, setMockActions } from '../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/flash_messages_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/flash_messages_logic.test.ts index c7dc658dada74..19e236ac122f0 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/flash_messages_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/flash_messages_logic.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { mockKibanaValues } from '../../__mocks__/kibana_logic.mock'; +import { mockKibanaValues } from '../../__mocks__/kea_logic/kibana_logic.mock'; import { resetContext } from 'kea'; diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/handle_api_errors.test.ts b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/handle_api_errors.test.ts index b6b0e23ce7d6a..b361e796b4f43 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/handle_api_errors.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/handle_api_errors.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import '../../__mocks__/kibana_logic.mock'; +import '../../__mocks__/kea_logic/kibana_logic.mock'; import { FlashMessagesLogic } from './flash_messages_logic'; diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/set_message_helpers.test.ts b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/set_message_helpers.test.ts index d22be32e038cb..6d56c7b202797 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/set_message_helpers.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/set_message_helpers.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import '../../__mocks__/kibana_logic.mock'; +import '../../__mocks__/kea_logic/kibana_logic.mock'; import { FlashMessagesLogic } from './flash_messages_logic'; import { diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/kibana/kibana_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/shared/kibana/kibana_logic.test.ts index a5f54d16b2fad..4cc907c3de9e4 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/kibana/kibana_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/kibana/kibana_logic.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { mockKibanaValues } from '../../__mocks__'; +import { mockKibanaValues } from '../../__mocks__/kea_logic'; import { resetContext } from 'kea'; diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/kibana_chrome/generate_breadcrumbs.test.ts b/x-pack/plugins/enterprise_search/public/applications/shared/kibana_chrome/generate_breadcrumbs.test.ts index c05c4dcbdddc0..f5d10ba4bc00f 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/kibana_chrome/generate_breadcrumbs.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/kibana_chrome/generate_breadcrumbs.test.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { setMockValues, mockKibanaValues, mockHistory } from '../../__mocks__'; +import { setMockValues, mockKibanaValues } from '../../__mocks__/kea_logic'; +import { mockHistory } from '../../__mocks__/react_router'; jest.mock('../react_router_helpers', () => ({ letBrowserHandleEvent: jest.fn(() => false), diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/kibana_chrome/set_chrome.test.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/kibana_chrome/set_chrome.test.tsx index c9743e6824018..d396aba895587 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/kibana_chrome/set_chrome.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/kibana_chrome/set_chrome.test.tsx @@ -6,7 +6,8 @@ */ import '../../__mocks__/shallow_useeffect.mock'; -import { setMockValues, mockKibanaValues, mockHistory } from '../../__mocks__'; +import { setMockValues, mockKibanaValues } from '../../__mocks__/kea_logic'; +import { mockHistory } from '../../__mocks__/react_router'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/layout/side_nav.test.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/layout/side_nav.test.tsx index 451b49738029d..244037d6e1382 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/layout/side_nav.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/layout/side_nav.test.tsx @@ -5,10 +5,9 @@ * 2.0. */ -import '../../__mocks__/react_router_history.mock'; +import { mockLocation } from '../../__mocks__/react_router'; import React from 'react'; -import { useLocation } from 'react-router-dom'; import { shallow } from 'enzyme'; @@ -63,7 +62,7 @@ describe('SideNavLink', () => { }); it('sets an active class if the current path matches the nav link', () => { - (useLocation as jest.Mock).mockImplementationOnce(() => ({ pathname: '/test/' })); + mockLocation.pathname = '/test/'; const wrapper = shallow(Link); @@ -71,7 +70,7 @@ describe('SideNavLink', () => { }); it('sets an active class if the current path is / and the link isRoot', () => { - (useLocation as jest.Mock).mockImplementationOnce(() => ({ pathname: '/' })); + mockLocation.pathname = '/'; const wrapper = shallow( @@ -111,7 +110,7 @@ describe('SideNavLink', () => { describe('shouldShowActiveForSubroutes', () => { it("won't set an active class when route is a subroute of 'to'", () => { - (useLocation as jest.Mock).mockImplementationOnce(() => ({ pathname: '/documents/1234' })); + mockLocation.pathname = '/documents/1234'; const wrapper = shallow( @@ -123,7 +122,7 @@ describe('SideNavLink', () => { }); it('sets an active class if the current path is a subRoute of "to", and shouldShowActiveForSubroutes is true', () => { - (useLocation as jest.Mock).mockImplementationOnce(() => ({ pathname: '/documents/1234' })); + mockLocation.pathname = '/documents/1234'; const wrapper = shallow( diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/not_found/not_found.test.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/not_found/not_found.test.tsx index 7e75b2b47bb7a..1561224a26e42 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/not_found/not_found.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/not_found/not_found.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues } from '../../__mocks__/kea.mock'; +import { setMockValues } from '../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/react_router_helpers/create_href.test.ts b/x-pack/plugins/enterprise_search/public/applications/shared/react_router_helpers/create_href.test.ts index fe2973cfdee32..2ffe87279d44f 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/react_router_helpers/create_href.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/react_router_helpers/create_href.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { mockHistory } from '../../__mocks__'; +import { mockHistory } from '../../__mocks__/react_router'; import { httpServiceMock } from 'src/core/public/mocks'; diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/react_router_helpers/eui_components.test.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/react_router_helpers/eui_components.test.tsx index 75639ffeb9d6b..7fded20cdd87e 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/react_router_helpers/eui_components.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/react_router_helpers/eui_components.test.tsx @@ -5,9 +5,8 @@ * 2.0. */ -import '../../__mocks__/kea.mock'; - -import { mockKibanaValues, mockHistory } from '../../__mocks__'; +import { mockKibanaValues } from '../../__mocks__/kea_logic'; +import { mockHistory } from '../../__mocks__/react_router'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/setup_guide/cloud/instructions.test.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/setup_guide/cloud/instructions.test.tsx index 0136f9745c322..58b6bc8a6c485 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/setup_guide/cloud/instructions.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/setup_guide/cloud/instructions.test.tsx @@ -5,14 +5,14 @@ * 2.0. */ -import { mountWithIntl } from '../../../__mocks__'; - import React from 'react'; import { shallow } from 'enzyme'; import { EuiSteps, EuiLink } from '@elastic/eui'; +import { mountWithIntl } from '../../../test_helpers'; + import { CloudSetupInstructions } from './instructions'; describe('CloudSetupInstructions', () => { diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/setup_guide/instructions.test.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/setup_guide/instructions.test.tsx index fd31ca720b82b..9f65e6b599a98 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/setup_guide/instructions.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/setup_guide/instructions.test.tsx @@ -5,14 +5,14 @@ * 2.0. */ -import { mountWithIntl } from '../../__mocks__'; - import React from 'react'; import { shallow } from 'enzyme'; import { EuiSteps, EuiLink } from '@elastic/eui'; +import { mountWithIntl } from '../../test_helpers'; + import { SetupInstructions } from './instructions'; describe('SetupInstructions', () => { diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/setup_guide/setup_guide.test.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/setup_guide/setup_guide.test.tsx index 90ddddd7d20aa..e33b9d29689c4 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/setup_guide/setup_guide.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/setup_guide/setup_guide.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, rerender } from '../../__mocks__'; +import { setMockValues } from '../../__mocks__/kea_logic'; import React from 'react'; @@ -13,6 +13,8 @@ import { shallow, ShallowWrapper } from 'enzyme'; import { EuiIcon } from '@elastic/eui'; +import { rerender } from '../../test_helpers'; + import { CloudSetupInstructions } from './cloud/instructions'; import { SetupInstructions } from './instructions'; 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 5fc8074d0a4d7..bd9b7fb5bfbe3 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 @@ -6,7 +6,7 @@ */ import '../../__mocks__/shallow_useeffect.mock'; -import { mockTelemetryActions } from '../../__mocks__'; +import { mockTelemetryActions } from '../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/telemetry/telemetry_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/shared/telemetry/telemetry_logic.test.ts index e516daedc1ba6..d80750d068f2b 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/telemetry/telemetry_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/telemetry/telemetry_logic.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { LogicMounter, mockHttpValues } from '../../__mocks__'; +import { LogicMounter, mockHttpValues } from '../../__mocks__/kea_logic'; import { JSON_HEADER as headers } from '../../../../common/constants'; diff --git a/x-pack/plugins/enterprise_search/public/applications/__mocks__/enzyme_rerender.mock.ts b/x-pack/plugins/enterprise_search/public/applications/test_helpers/enzyme_rerender.ts similarity index 100% rename from x-pack/plugins/enterprise_search/public/applications/__mocks__/enzyme_rerender.mock.ts rename to x-pack/plugins/enterprise_search/public/applications/test_helpers/enzyme_rerender.ts diff --git a/x-pack/plugins/enterprise_search/public/applications/__mocks__/expected_async_error.ts b/x-pack/plugins/enterprise_search/public/applications/test_helpers/expected_async_error.ts similarity index 100% rename from x-pack/plugins/enterprise_search/public/applications/__mocks__/expected_async_error.ts rename to x-pack/plugins/enterprise_search/public/applications/test_helpers/expected_async_error.ts diff --git a/x-pack/plugins/enterprise_search/public/applications/test_helpers/index.ts b/x-pack/plugins/enterprise_search/public/applications/test_helpers/index.ts new file mode 100644 index 0000000000000..e34ff763637b5 --- /dev/null +++ b/x-pack/plugins/enterprise_search/public/applications/test_helpers/index.ts @@ -0,0 +1,15 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +// Enzyme helpers +export { mountAsync } from './mount_async'; +export { mountWithIntl } from './mount_with_i18n'; +export { shallowWithIntl } from './shallow_with_i18n'; +export { rerender } from './enzyme_rerender'; + +// Misc +export { expectedAsyncError } from './expected_async_error'; diff --git a/x-pack/plugins/enterprise_search/public/applications/__mocks__/mount_async.mock.tsx b/x-pack/plugins/enterprise_search/public/applications/test_helpers/mount_async.tsx similarity index 96% rename from x-pack/plugins/enterprise_search/public/applications/__mocks__/mount_async.mock.tsx rename to x-pack/plugins/enterprise_search/public/applications/test_helpers/mount_async.tsx index 886effcd54057..cd66c0ae85a91 100644 --- a/x-pack/plugins/enterprise_search/public/applications/__mocks__/mount_async.mock.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/test_helpers/mount_async.tsx @@ -5,13 +5,13 @@ * 2.0. */ -import { mountWithIntl } from './mount_with_i18n.mock'; - import React from 'react'; import { mount, ReactWrapper } from 'enzyme'; import { act } from 'react-dom/test-utils'; +import { mountWithIntl } from './mount_with_i18n'; + /** * This helper is intended for components that have async effects * (e.g. http fetches) on mount. It mostly adds act/update boilerplate diff --git a/x-pack/plugins/enterprise_search/public/applications/__mocks__/mount_with_i18n.mock.tsx b/x-pack/plugins/enterprise_search/public/applications/test_helpers/mount_with_i18n.tsx similarity index 100% rename from x-pack/plugins/enterprise_search/public/applications/__mocks__/mount_with_i18n.mock.tsx rename to x-pack/plugins/enterprise_search/public/applications/test_helpers/mount_with_i18n.tsx diff --git a/x-pack/plugins/enterprise_search/public/applications/__mocks__/shallow_with_i18n.mock.tsx b/x-pack/plugins/enterprise_search/public/applications/test_helpers/shallow_with_i18n.tsx similarity index 100% rename from x-pack/plugins/enterprise_search/public/applications/__mocks__/shallow_with_i18n.mock.tsx rename to x-pack/plugins/enterprise_search/public/applications/test_helpers/shallow_with_i18n.tsx diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/app_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/app_logic.test.ts index 34e67acc870ee..b2cc835da4ecd 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/app_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/app_logic.test.ts @@ -6,7 +6,7 @@ */ import { DEFAULT_INITIAL_APP_DATA } from '../../../common/__mocks__'; -import { LogicMounter } from '../__mocks__'; +import { LogicMounter } from '../__mocks__/kea_logic'; import { AppLogic } from './app_logic'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/layout/account_header/account_header.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/layout/account_header/account_header.test.tsx index e8035f01a9405..9df11ab2308da 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/layout/account_header/account_header.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/layout/account_header/account_header.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues } from '../../../../__mocks__'; +import { setMockValues } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/product_button/product_button.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/product_button/product_button.test.tsx index 0bced6a7fc4e0..e605e914df061 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/product_button/product_button.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/product_button/product_button.test.tsx @@ -5,8 +5,7 @@ * 2.0. */ -import '../../../../__mocks__/kea.mock'; -import { mockTelemetryActions } from '../../../../__mocks__'; +import { mockTelemetryActions } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/index.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/index.test.tsx index 2c2859e8f4427..fb0ea82220640 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/index.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/index.test.tsx @@ -5,8 +5,9 @@ * 2.0. */ +import '../__mocks__/react_router'; import '../__mocks__/shallow_useeffect.mock'; -import { setMockValues, setMockActions, mockKibanaValues } from '../__mocks__'; +import { setMockValues, setMockActions, mockKibanaValues } from '../__mocks__/kea_logic'; import React from 'react'; import { Redirect } from 'react-router-dom'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/add_source.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/add_source.test.tsx index 0ee872f7cfe8a..92cbfcf6eeafe 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/add_source.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/add_source.test.tsx @@ -6,7 +6,11 @@ */ import '../../../../../__mocks__/shallow_useeffect.mock'; -import { mockKibanaValues, setMockActions, setMockValues } from '../../../../../__mocks__'; +import { + mockKibanaValues, + setMockActions, + setMockValues, +} from '../../../../../__mocks__/kea_logic'; import { sourceConfigData } from '../../../../__mocks__/content_sources.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/add_source_list.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/add_source_list.test.tsx index 90da349ea4f27..6bf71cd73ec35 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/add_source_list.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/add_source_list.test.tsx @@ -6,7 +6,7 @@ */ import '../../../../../__mocks__/shallow_useeffect.mock'; -import { setMockActions, setMockValues } from '../../../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../../../__mocks__/kea_logic'; import { contentSources, configuredSources, diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/add_source_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/add_source_logic.test.ts index b52b354a6b115..fcaa847c47f3e 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/add_source_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/add_source_logic.test.ts @@ -10,7 +10,7 @@ import { mockFlashMessageHelpers, mockHttpValues, mockKibanaValues, -} from '../../../../../__mocks__'; +} from '../../../../../__mocks__/kea_logic'; import { sourceConfigData } from '../../../../__mocks__/content_sources.mock'; import { nextTick } from '@kbn/test/jest'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/available_sources_list.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/available_sources_list.test.tsx index fcb55f24ddb03..26a3d38f247ea 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/available_sources_list.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/available_sources_list.test.tsx @@ -6,7 +6,7 @@ */ import '../../../../../__mocks__/shallow_useeffect.mock'; -import { setMockValues } from '../../../../../__mocks__'; +import { setMockValues } from '../../../../../__mocks__/kea_logic'; import { mergedAvailableSources } from '../../../../__mocks__/content_sources.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/configure_custom.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/configure_custom.test.tsx index 099989255bf47..6c0d87b7696ec 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/configure_custom.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/configure_custom.test.tsx @@ -6,7 +6,7 @@ */ import '../../../../../__mocks__/shallow_useeffect.mock'; -import { setMockActions, setMockValues } from '../../../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/configure_oauth.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/configure_oauth.test.tsx index 533dfcda70db1..332456cae99ad 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/configure_oauth.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/configure_oauth.test.tsx @@ -6,7 +6,7 @@ */ import '../../../../../__mocks__/shallow_useeffect.mock'; -import { setMockActions, setMockValues } from '../../../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/connect_instance.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/connect_instance.test.tsx index d6b427630e48e..d8696118d7f4e 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/connect_instance.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/connect_instance.test.tsx @@ -6,7 +6,7 @@ */ import '../../../../../__mocks__/shallow_useeffect.mock'; -import { setMockActions, setMockValues } from '../../../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/reauthenticate.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/reauthenticate.test.tsx index c38ab167b18de..b826b8b42232e 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/reauthenticate.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/reauthenticate.test.tsx @@ -5,8 +5,9 @@ * 2.0. */ +import '../../../../../__mocks__/react_router'; import '../../../../../__mocks__/shallow_useeffect.mock'; -import { setMockActions, setMockValues } from '../../../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/save_config.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/save_config.test.tsx index c0f7f1139cb73..32e1c59c56293 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/save_config.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/save_config.test.tsx @@ -6,7 +6,7 @@ */ import '../../../../../__mocks__/shallow_useeffect.mock'; -import { setMockActions, setMockValues } from '../../../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../../../__mocks__/kea_logic'; import { sourceConfigData } from '../../../../__mocks__/content_sources.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/source_features.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/source_features.test.tsx index cd8ba37695ac6..6afac428f2866 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/source_features.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/source_features.test.tsx @@ -5,12 +5,14 @@ * 2.0. */ -import { mountAsync, setMockValues } from '../../../../../__mocks__'; +import { setMockValues } from '../../../../../__mocks__/kea_logic'; import React from 'react'; import { EuiPanel } from '@elastic/eui'; +import { mountWithIntl } from '../../../../../test_helpers'; + import { staticSourceData } from '../../source_data'; import { SourceFeatures } from './source_features'; @@ -26,7 +28,7 @@ describe('SourceFeatures', () => { it('renders hasPlatinumLicense & isOrganization', async () => { setMockValues({ hasPlatinumLicense: true, isOrganization: true }); - const wrapper = await mountAsync(, { i18n: true }); + const wrapper = await mountWithIntl(); expect(wrapper.find('FeaturesRouter[featureId="SyncFrequency"]')).toHaveLength(1); expect(wrapper.find('FeaturesRouter[featureId="SyncedItems"]')).toHaveLength(1); @@ -34,7 +36,7 @@ describe('SourceFeatures', () => { it('renders !hasPlatinumLicense & isOrganization', async () => { setMockValues({ hasPlatinumLicense: false, isOrganization: true }); - const wrapper = await mountAsync(, { i18n: true }); + const wrapper = await mountWithIntl(); expect(wrapper.find('FeaturesRouter[featureId="SyncFrequency"]')).toHaveLength(1); expect(wrapper.find('FeaturesRouter[featureId="SyncedItems"]')).toHaveLength(1); @@ -43,7 +45,7 @@ describe('SourceFeatures', () => { it('renders hasPlatinumLicense & !isOrganization', async () => { setMockValues({ hasPlatinumLicense: true, isOrganization: false }); - const wrapper = await mountAsync(, { i18n: true }); + const wrapper = await mountWithIntl(); expect(wrapper.find('FeaturesRouter[featureId="Private"]')).toHaveLength(1); expect(wrapper.find('FeaturesRouter[featureId="SyncedItems"]')).toHaveLength(1); @@ -52,7 +54,7 @@ describe('SourceFeatures', () => { it('renders !hasPlatinumLicense & !isOrganization', async () => { setMockValues({ hasPlatinumLicense: false, isOrganization: false }); - const wrapper = await mountAsync(, { i18n: true }); + const wrapper = await mountWithIntl(); expect(wrapper.find('IncludedFeatures').find(EuiPanel)).toHaveLength(0); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/display_settings.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/display_settings.test.tsx index 54be43596a431..aa5cec385738d 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/display_settings.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/display_settings.test.tsx @@ -7,7 +7,7 @@ import '../../../../../__mocks__/shallow_useeffect.mock'; -import { setMockValues, setMockActions } from '../../../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../../../__mocks__/kea_logic'; import { exampleResult } from '../../../../__mocks__/content_sources.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/display_settings_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/display_settings_logic.test.ts index 5a6ef5ba5990f..10c715c80b3d6 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/display_settings_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/display_settings_logic.test.ts @@ -10,7 +10,7 @@ import { mockFlashMessageHelpers, mockHttpValues, mockKibanaValues, -} from '../../../../../__mocks__'; +} from '../../../../../__mocks__/kea_logic'; import { exampleResult } from '../../../../__mocks__/content_sources.mock'; import { nextTick } from '@kbn/test/jest'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/display_settings_router.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/display_settings_router.test.tsx index f04afe60aa49d..7f4e566022ab4 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/display_settings_router.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/display_settings_router.test.tsx @@ -7,7 +7,7 @@ import '../../../../../__mocks__/shallow_useeffect.mock'; -import { setMockValues } from '../../../../../__mocks__'; +import { setMockValues } from '../../../../../__mocks__/kea_logic'; import React from 'react'; import { Route, Switch } from 'react-router-dom'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/example_result_detail_card.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/example_result_detail_card.test.tsx index 15e1fe0ed417c..82a421d85df01 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/example_result_detail_card.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/example_result_detail_card.test.tsx @@ -7,7 +7,7 @@ import '../../../../../__mocks__/shallow_useeffect.mock'; -import { setMockValues } from '../../../../../__mocks__'; +import { setMockValues } from '../../../../../__mocks__/kea_logic'; import { exampleResult } from '../../../../__mocks__/content_sources.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/example_search_result_group.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/example_search_result_group.test.tsx index 6f90c1045ae31..7139ea30be137 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/example_search_result_group.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/example_search_result_group.test.tsx @@ -7,7 +7,7 @@ import '../../../../../__mocks__/shallow_useeffect.mock'; -import { setMockValues } from '../../../../../__mocks__'; +import { setMockValues } from '../../../../../__mocks__/kea_logic'; import { exampleResult } from '../../../../__mocks__/content_sources.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/example_standout_result.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/example_standout_result.test.tsx index 49845e79d86aa..a38e0ce82490d 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/example_standout_result.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/example_standout_result.test.tsx @@ -7,7 +7,7 @@ import '../../../../../__mocks__/shallow_useeffect.mock'; -import { setMockValues } from '../../../../../__mocks__'; +import { setMockValues } from '../../../../../__mocks__/kea_logic'; import { exampleResult } from '../../../../__mocks__/content_sources.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/field_editor_modal.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/field_editor_modal.test.tsx index fe7bced843841..7d828549178e0 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/field_editor_modal.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/field_editor_modal.test.tsx @@ -7,7 +7,7 @@ import '../../../../../__mocks__/shallow_useeffect.mock'; -import { setMockValues, setMockActions } from '../../../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../../../__mocks__/kea_logic'; import { exampleResult } from '../../../../__mocks__/content_sources.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/result_detail.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/result_detail.test.tsx index 768573ce80fee..f400527c6c003 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/result_detail.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/result_detail.test.tsx @@ -6,7 +6,7 @@ */ import '../../../../../__mocks__/shallow_useeffect.mock'; -import { setMockValues, setMockActions } from '../../../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../../../__mocks__/kea_logic'; import { exampleResult } from '../../../../__mocks__/content_sources.mock'; /** diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/search_results.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/search_results.test.tsx index 28de0006f162f..cc0378b4b70db 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/search_results.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/search_results.test.tsx @@ -7,7 +7,7 @@ import '../../../../../__mocks__/shallow_useeffect.mock'; -import { setMockValues, setMockActions } from '../../../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../../../__mocks__/kea_logic'; import { exampleResult } from '../../../../__mocks__/content_sources.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/overview.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/overview.test.tsx index a30f1bfbd596a..f2cf5f50b813b 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/overview.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/overview.test.tsx @@ -7,7 +7,7 @@ import '../../../../__mocks__/shallow_useeffect.mock'; -import { setMockValues } from '../../../../__mocks__'; +import { setMockValues } from '../../../../__mocks__/kea_logic'; import { fullContentSources } from '../../../__mocks__/content_sources.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/schema/schema.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/schema/schema.test.tsx index 6b656fbdc6ddb..178c9125ee437 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/schema/schema.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/schema/schema.test.tsx @@ -7,7 +7,7 @@ import '../../../../../__mocks__/shallow_useeffect.mock'; -import { setMockValues, setMockActions } from '../../../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../../../__mocks__/kea_logic'; import { mostRecentIndexJob } from '../../../../__mocks__/content_sources.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/schema/schema_change_errors.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/schema/schema_change_errors.test.tsx index f600d089c6e06..fdb729b59b097 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/schema/schema_change_errors.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/schema/schema_change_errors.test.tsx @@ -5,12 +5,11 @@ * 2.0. */ +import { setMockValues, setMockActions } from '../../../../../__mocks__/kea_logic'; +import { mockUseParams } from '../../../../../__mocks__/react_router'; import '../../../../../__mocks__/shallow_useeffect.mock'; -import { setMockValues, setMockActions } from '../../../../../__mocks__'; - import React from 'react'; -import { useParams } from 'react-router-dom'; import { shallow } from 'enzyme'; @@ -27,7 +26,7 @@ describe('SchemaChangeErrors', () => { setMockValues({ fieldCoercionErrors, serverSchema }); setMockActions({ initializeSchemaFieldErrors: jest.fn() }); - (useParams as jest.Mock).mockImplementationOnce(() => ({ + mockUseParams.mockImplementationOnce(() => ({ activeReindexJobId: '1', sourceId: '123', })); diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/schema/schema_fields_table.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/schema/schema_fields_table.test.tsx index 9996e58e819b2..c2c364763e2eb 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/schema/schema_fields_table.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/schema/schema_fields_table.test.tsx @@ -7,7 +7,7 @@ import '../../../../../__mocks__/shallow_useeffect.mock'; -import { setMockValues, setMockActions } from '../../../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/schema/schema_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/schema/schema_logic.test.ts index 650909c0b5a82..fd1a574b3438f 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/schema/schema_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/schema/schema_logic.test.ts @@ -5,7 +5,11 @@ * 2.0. */ -import { LogicMounter, mockFlashMessageHelpers, mockHttpValues } from '../../../../../__mocks__'; +import { + LogicMounter, + mockFlashMessageHelpers, + mockHttpValues, +} from '../../../../../__mocks__/kea_logic'; import { mostRecentIndexJob } from '../../../../__mocks__/content_sources.mock'; import { nextTick } from '@kbn/test/jest'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_added.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_added.test.tsx index 9eecc41aa1778..a182c2697fe90 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_added.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_added.test.tsx @@ -5,9 +5,9 @@ * 2.0. */ +import '../../../../__mocks__/react_router'; import '../../../../__mocks__/shallow_useeffect.mock'; - -import { setMockActions, setMockValues } from '../../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../../__mocks__/kea_logic'; import React from 'react'; import { useLocation } from 'react-router-dom'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_content.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_content.test.tsx index 8aa644827709a..4bcc4b16166d1 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_content.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_content.test.tsx @@ -7,7 +7,7 @@ import '../../../../__mocks__/shallow_useeffect.mock'; -import { setMockValues, setMockActions } from '../../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic'; import { fullContentSources, contentItems } from '../../../__mocks__/content_sources.mock'; import { meta } from '../../../__mocks__/meta.mock'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_settings.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_settings.test.tsx index b2a4488b04107..74f32cc22c2a8 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_settings.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_settings.test.tsx @@ -7,7 +7,7 @@ import '../../../../__mocks__/shallow_useeffect.mock'; -import { setMockValues, setMockActions } from '../../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic'; import { fullContentSources, sourceConfigData } from '../../../__mocks__/content_sources.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_sub_nav.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_sub_nav.test.tsx index 59f3bfb0a5611..25c389419d731 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_sub_nav.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_sub_nav.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues } from '../../../../__mocks__'; +import { setMockValues } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/organization_sources.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/organization_sources.test.tsx index b986658f19fb3..9df91406c4b7b 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/organization_sources.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/organization_sources.test.tsx @@ -6,8 +6,7 @@ */ import '../../../__mocks__/shallow_useeffect.mock'; - -import { setMockValues, setMockActions } from '../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../__mocks__/kea_logic'; import { contentSources } from '../../__mocks__/content_sources.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/private_sources.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/private_sources.test.tsx index e6f19ff13b3cc..08f560c984344 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/private_sources.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/private_sources.test.tsx @@ -7,7 +7,7 @@ import '../../../__mocks__/shallow_useeffect.mock'; -import { setMockValues, setMockActions } from '../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/private_sources_layout.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/private_sources_layout.test.tsx index 7558eb1e4e662..6af439814b891 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/private_sources_layout.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/private_sources_layout.test.tsx @@ -7,7 +7,7 @@ import '../../../__mocks__/shallow_useeffect.mock'; -import { setMockValues } from '../../../__mocks__'; +import { setMockValues } from '../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/source_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/source_logic.test.ts index 2cf867446b7fb..03f46830fafc3 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/source_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/source_logic.test.ts @@ -10,12 +10,12 @@ import { mockFlashMessageHelpers, mockHttpValues, mockKibanaValues, - expectedAsyncError, -} from '../../../__mocks__'; +} from '../../../__mocks__/kea_logic'; import { fullContentSources, contentItems } from '../../__mocks__/content_sources.mock'; import { meta } from '../../__mocks__/meta.mock'; import { DEFAULT_META } from '../../../shared/constants'; +import { expectedAsyncError } from '../../../test_helpers'; jest.mock('../../app_logic', () => ({ AppLogic: { values: { isOrganization: true } }, diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/source_router.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/source_router.test.tsx index dda3eeea54926..783fc434fe8e5 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/source_router.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/source_router.test.tsx @@ -7,13 +7,12 @@ import '../../../__mocks__/shallow_useeffect.mock'; -import { setMockValues, setMockActions } from '../../../__mocks__'; -import { mockLocation } from '../../../__mocks__/react_router_history.mock'; +import { setMockValues, setMockActions } from '../../../__mocks__/kea_logic'; +import { mockLocation, mockUseParams } from '../../../__mocks__/react_router'; import { unmountHandler } from '../../../__mocks__/shallow_useeffect.mock'; import { contentSources } from '../../__mocks__/content_sources.mock'; import React from 'react'; -import { useParams } from 'react-router-dom'; import { Route, Switch } from 'react-router-dom'; import { shallow } from 'enzyme'; @@ -46,7 +45,7 @@ describe('SourceRouter', () => { resetSourceState, }); setMockValues({ ...mockValues }); - (useParams as jest.Mock).mockImplementationOnce(() => ({ + mockUseParams.mockImplementationOnce(() => ({ sourceId: contentSource.id, })); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/sources_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/sources_logic.test.ts index 13844f51b2319..74d3faca5994b 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/sources_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/sources_logic.test.ts @@ -9,10 +9,11 @@ import { LogicMounter, mockFlashMessageHelpers, mockHttpValues, - expectedAsyncError, -} from '../../../__mocks__'; +} from '../../../__mocks__/kea_logic'; import { configuredSources, contentSources } from '../../__mocks__/content_sources.mock'; +import { expectedAsyncError } from '../../../test_helpers'; + jest.mock('../../app_logic', () => ({ AppLogic: { values: { isOrganization: true } }, })); diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/sources_router.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/sources_router.test.tsx index eac1bd7d3ea27..3ba5161e5a3e3 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/sources_router.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/sources_router.test.tsx @@ -5,9 +5,9 @@ * 2.0. */ +import '../../../__mocks__/react_router'; import '../../../__mocks__/shallow_useeffect.mock'; - -import { setMockValues, setMockActions } from '../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../__mocks__/kea_logic'; import React from 'react'; import { Route, Switch, Redirect } from 'react-router-dom'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/sources_view.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/sources_view.test.tsx index 06d7ecff50299..507e66bdf0332 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/sources_view.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/sources_view.test.tsx @@ -7,7 +7,7 @@ import '../../../__mocks__/shallow_useeffect.mock'; -import { setMockValues, setMockActions } from '../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/add_group_modal.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/add_group_modal.test.tsx index 784544b0001fa..7468f9c937943 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/add_group_modal.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/add_group_modal.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues, setMockActions } from '../../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/clear_filters_link.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/clear_filters_link.test.tsx index 9118bc5e7adf3..dd4b22c6ca62c 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/clear_filters_link.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/clear_filters_link.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockActions } from '../../../../__mocks__'; +import { setMockActions } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/filterable_users_popover.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/filterable_users_popover.test.tsx index 1813b766b9875..dc7e635d8fa6b 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/filterable_users_popover.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/filterable_users_popover.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockActions } from '../../../../__mocks__'; +import { setMockActions } from '../../../../__mocks__/kea_logic'; import { users } from '../../../__mocks__/users.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_manager_modal.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_manager_modal.test.tsx index 7c39414f158ef..5619698335b30 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_manager_modal.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_manager_modal.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues } from '../../../../__mocks__'; +import { setMockValues } from '../../../../__mocks__/kea_logic'; import { contentSources } from '../../../__mocks__/content_sources.mock'; import { groups } from '../../../__mocks__/groups.mock'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_overview.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_overview.test.tsx index 8d5714fd05792..7f60b8d8584ba 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_overview.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_overview.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockActions, setMockValues } from '../../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../../__mocks__/kea_logic'; import { groups } from '../../../__mocks__/groups.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_row.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_row.test.tsx index 205eafd69cd10..7915482a45b2a 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_row.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_row.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues } from '../../../../__mocks__'; +import { setMockValues } from '../../../../__mocks__/kea_logic'; import { groups } from '../../../__mocks__/groups.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_row_users_dropdown.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_row_users_dropdown.test.tsx index e75b325a4eae9..1116c625be07a 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_row_users_dropdown.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_row_users_dropdown.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockActions, setMockValues } from '../../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../../__mocks__/kea_logic'; import { users } from '../../../__mocks__/users.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_source_prioritization.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_source_prioritization.test.tsx index 4a9244486bf30..0faeb1df5398c 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_source_prioritization.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_source_prioritization.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockActions, setMockValues } from '../../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../../__mocks__/kea_logic'; import { groups } from '../../../__mocks__/groups.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_sub_nav.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_sub_nav.test.tsx index e4dde81949bfa..263ec5f1b27c0 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_sub_nav.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_sub_nav.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues } from '../../../../__mocks__'; +import { setMockValues } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_users_table.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_users_table.test.tsx index a6376d7653627..0dde2f5eaf7f7 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_users_table.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_users_table.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues } from '../../../../__mocks__'; +import { setMockValues } from '../../../../__mocks__/kea_logic'; import { groups } from '../../../__mocks__/groups.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/groups_table.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/groups_table.test.tsx index f60a13ec296d5..d11b830a8fc4b 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/groups_table.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/groups_table.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockActions, setMockValues } from '../../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../../__mocks__/kea_logic'; import { groups } from '../../../__mocks__/groups.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/manage_users_modal.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/manage_users_modal.test.tsx index 49d51dfc7254c..5256155979e4d 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/manage_users_modal.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/manage_users_modal.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockActions, setMockValues } from '../../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../../__mocks__/kea_logic'; import { users } from '../../../__mocks__/users.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/shared_sources_modal.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/shared_sources_modal.test.tsx index dd72850a06ad9..02f0b53af97cc 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/shared_sources_modal.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/shared_sources_modal.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockActions, setMockValues } from '../../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../../__mocks__/kea_logic'; import { groups } from '../../../__mocks__/groups.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/table_filter_sources_dropdown.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/table_filter_sources_dropdown.test.tsx index 1e2a57da9ad2e..4150604fb8079 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/table_filter_sources_dropdown.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/table_filter_sources_dropdown.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockActions, setMockValues } from '../../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../../__mocks__/kea_logic'; import { contentSources } from '../../../__mocks__/content_sources.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/table_filter_users_dropdown.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/table_filter_users_dropdown.test.tsx index e472563862015..93e5ad69964ca 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/table_filter_users_dropdown.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/table_filter_users_dropdown.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockActions, setMockValues } from '../../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../../__mocks__/kea_logic'; import { users } from '../../../__mocks__/users.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/table_filters.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/table_filters.test.tsx index bcc58c394b516..83a20efe5257e 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/table_filters.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/table_filters.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockActions, setMockValues } from '../../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_logic.test.ts index 9f12e8f202d50..2c9ca642f2283 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_logic.test.ts @@ -10,7 +10,7 @@ import { mockKibanaValues, mockFlashMessageHelpers, mockHttpValues, -} from '../../../__mocks__'; +} from '../../../__mocks__/kea_logic'; import { groups } from '../../__mocks__/groups.mock'; import { mockGroupValues } from './__mocks__/group_logic.mock'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_router.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_router.test.tsx index 0b218f2496154..4c13dbce3ef1e 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_router.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_router.test.tsx @@ -5,8 +5,9 @@ * 2.0. */ +import '../../../__mocks__/react_router'; import '../../../__mocks__/shallow_useeffect.mock'; -import { setMockValues, setMockActions } from '../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../__mocks__/kea_logic'; import { groups } from '../../__mocks__/groups.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups.test.tsx index 54f8580a8eab9..2929fa0ff1d61 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups.test.tsx @@ -6,7 +6,7 @@ */ import '../../../__mocks__/shallow_useeffect.mock'; -import { setMockActions, setMockValues } from '../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../__mocks__/kea_logic'; import { groups } from '../../__mocks__/groups.mock'; import { meta } from '../../__mocks__/meta.mock'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups_logic.test.ts index bb6e7c0c76faf..c4a860368ff8b 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups_logic.test.ts @@ -5,7 +5,11 @@ * 2.0. */ -import { LogicMounter, mockFlashMessageHelpers, mockHttpValues } from '../../../__mocks__'; +import { + LogicMounter, + mockFlashMessageHelpers, + mockHttpValues, +} from '../../../__mocks__/kea_logic'; import { contentSources } from '../../__mocks__/content_sources.mock'; import { groups } from '../../__mocks__/groups.mock'; import { users } from '../../__mocks__/users.mock'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups_router.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups_router.test.tsx index 0295605eddd4d..66204f74f51f1 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups_router.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups_router.test.tsx @@ -6,7 +6,7 @@ */ import '../../../__mocks__/shallow_useeffect.mock'; -import { setMockActions } from '../../../__mocks__'; +import { setMockActions } from '../../../__mocks__/kea_logic'; import React from 'react'; import { Route, Switch } from 'react-router-dom'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/__mocks__/overview_logic.mock.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/__mocks__/overview_logic.mock.ts index 787354974cb31..9aaa6253ea0ab 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/__mocks__/overview_logic.mock.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/__mocks__/overview_logic.mock.ts @@ -6,7 +6,7 @@ */ import { DEFAULT_INITIAL_APP_DATA } from '../../../../../../common/__mocks__'; -import { setMockValues as setMockKeaValues, setMockActions } from '../../../../__mocks__/kea.mock'; +import { setMockValues as setMockKeaValues, setMockActions } from '../../../../__mocks__/kea_logic'; const { workplaceSearch: mockAppValues } = DEFAULT_INITIAL_APP_DATA; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/onboarding_card.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/onboarding_card.test.tsx index 2b9dc98b03567..382eb676f8708 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/onboarding_card.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/onboarding_card.test.tsx @@ -5,9 +5,8 @@ * 2.0. */ -import '../../../__mocks__/kea.mock'; import '../../../__mocks__/enterprise_search_url.mock'; -import { mockTelemetryActions } from '../../../__mocks__'; +import { mockTelemetryActions } from '../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/onboarding_steps.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/onboarding_steps.test.tsx index 5059533519a6f..01e5245c597eb 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/onboarding_steps.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/onboarding_steps.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { mockTelemetryActions } from '../../../__mocks__'; +import { mockTelemetryActions } from '../../../__mocks__/kea_logic'; import { setMockValues } from './__mocks__'; import './__mocks__/overview_logic.mock'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/overview.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/overview.test.tsx index 19c893bec81ea..f4fa1dab89810 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/overview.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/overview.test.tsx @@ -5,7 +5,6 @@ * 2.0. */ -import '../../../__mocks__/react_router_history.mock'; import './__mocks__/overview_logic.mock'; import { mockActions, setMockValues } from './__mocks__'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/overview_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/overview_logic.test.ts index 75a41216ffbb7..090715e14309a 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/overview_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/overview_logic.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { LogicMounter, mockHttpValues } from '../../../__mocks__'; +import { LogicMounter, mockHttpValues } from '../../../__mocks__/kea_logic'; import { mockOverviewValues } from './__mocks__'; import { OverviewLogic } from './overview_logic'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/recent_activity.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/recent_activity.test.tsx index 3a925f011cc18..0cb3f77c681a1 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/recent_activity.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/recent_activity.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { mockTelemetryActions } from '../../../__mocks__'; +import { mockTelemetryActions } from '../../../__mocks__/kea_logic'; import { setMockValues } from './__mocks__'; import './__mocks__/overview_logic.mock'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/role_mappings/role_mapping.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/role_mappings/role_mapping.test.tsx index 01981b1c3894e..619a931864500 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/role_mappings/role_mapping.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/role_mappings/role_mapping.test.tsx @@ -5,8 +5,9 @@ * 2.0. */ +import '../../../__mocks__/react_router'; import '../../../__mocks__/shallow_useeffect.mock'; -import { setMockActions, setMockValues } from '../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/role_mappings/role_mappings.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/role_mappings/role_mappings.test.tsx index 9559df2c1f981..d7ce8053c71f0 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/role_mappings/role_mappings.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/role_mappings/role_mappings.test.tsx @@ -6,7 +6,7 @@ */ import '../../../__mocks__/shallow_useeffect.mock'; -import { setMockActions, setMockValues } from '../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/role_mappings/role_mappings_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/role_mappings/role_mappings_logic.test.ts index 281e3cfdff1c1..716cb8ebb6d47 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/role_mappings/role_mappings_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/role_mappings/role_mappings_logic.test.ts @@ -5,8 +5,11 @@ * 2.0. */ -import { mockFlashMessageHelpers, mockHttpValues } from '../../../__mocks__'; -import { LogicMounter } from '../../../__mocks__/kea.mock'; +import { + LogicMounter, + mockFlashMessageHelpers, + mockHttpValues, +} from '../../../__mocks__/kea_logic'; import { groups } from '../../__mocks__/groups.mock'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/security/components/private_sources_table.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/security/components/private_sources_table.test.tsx index 4f7160ba631f1..65f9ac9cbb0f9 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/security/components/private_sources_table.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/security/components/private_sources_table.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { setMockValues } from '../../../../__mocks__'; +import { setMockValues } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/security/security.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/security/security.test.tsx index 346994ac557f9..c9720eb6c1c04 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/security/security.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/security/security.test.tsx @@ -6,7 +6,7 @@ */ import '../../../__mocks__/shallow_useeffect.mock'; -import { setMockValues, setMockActions } from '../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/security/security_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/security/security_logic.test.ts index 02d8fdd3c30e4..ecb97cea528b9 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/security/security_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/security/security_logic.test.ts @@ -5,8 +5,11 @@ * 2.0. */ -import { mockHttpValues, mockFlashMessageHelpers } from '../../../__mocks__'; -import { LogicMounter } from '../../../__mocks__/kea.mock'; +import { + LogicMounter, + mockHttpValues, + mockFlashMessageHelpers, +} from '../../../__mocks__/kea_logic'; import { nextTick } from '@kbn/test/jest'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/components/connectors.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/components/connectors.test.tsx index 13ef86a21a208..e95dd60ae6089 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/components/connectors.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/components/connectors.test.tsx @@ -7,7 +7,7 @@ import '../../../../__mocks__/shallow_useeffect.mock'; -import { setMockValues, setMockActions } from '../../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic'; import { configuredSources } from '../../../__mocks__/content_sources.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/components/customize.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/components/customize.test.tsx index ed05829d9e082..15d0db4c415d0 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/components/customize.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/components/customize.test.tsx @@ -7,7 +7,7 @@ import '../../../../__mocks__/shallow_useeffect.mock'; -import { setMockValues, setMockActions } from '../../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/components/oauth_application.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/components/oauth_application.test.tsx index 55a58610e0ed6..3c0cae212caa4 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/components/oauth_application.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/components/oauth_application.test.tsx @@ -7,7 +7,7 @@ import '../../../../__mocks__/shallow_useeffect.mock'; -import { setMockValues, setMockActions } from '../../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic'; import { oauthApplication } from '../../../__mocks__/content_sources.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/components/source_config.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/components/source_config.test.tsx index ed9f715fd6916..c9b458e8d3535 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/components/source_config.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/components/source_config.test.tsx @@ -7,7 +7,7 @@ import '../../../../__mocks__/shallow_useeffect.mock'; -import { setMockValues, setMockActions } from '../../../../__mocks__'; +import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic'; import { sourceConfigData } from '../../../__mocks__/content_sources.mock'; import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/settings_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/settings_logic.test.ts index a57c2c1f9ad44..0aef84ccf20e2 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/settings_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/settings_logic.test.ts @@ -5,8 +5,12 @@ * 2.0. */ -import { mockFlashMessageHelpers, mockHttpValues, mockKibanaValues } from '../../../__mocks__'; -import { LogicMounter } from '../../../__mocks__/kea.mock'; +import { + LogicMounter, + mockFlashMessageHelpers, + mockHttpValues, + mockKibanaValues, +} from '../../../__mocks__/kea_logic'; import { configuredSources, oauthApplication } from '../../__mocks__/content_sources.mock'; import { nextTick } from '@kbn/test/jest'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/settings_router.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/settings_router.test.tsx index 3c0dee2a874ae..6a9104ceefde0 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/settings_router.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/settings_router.test.tsx @@ -7,7 +7,7 @@ import '../../../__mocks__/shallow_useeffect.mock'; -import { setMockActions } from '../../../__mocks__'; +import { setMockActions } from '../../../__mocks__/kea_logic'; import React from 'react'; import { Route, Redirect, Switch } from 'react-router-dom';