mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
* Move enzyme & misc test helpers out of __mocks__/ and into new test_helpers/
They're not technically mocks since nothing is being mocked, so we should move them into a test_helpers folder for specificity & organization
* Move React Router mocks into its own separate folder/import
This was part of the initial feedback, that it was unclear why importing something for Kea in __mocks__/index.ts was mocking react router along for the ride. Separating this out makes things clearer and imports more explicit
+ add some handy new mock useX jest.fn()s helpers, so we're not doing `useParams() as jest.Mock` errywhere
* Move Kea & logic mocks/helpers into kea_logic subfolder
- for organization
NOTE: It can't be a plain kea/ folder because then Jest automatically mocks the `kea` module itself kea 🤦
* Fix type failures
- Caused by switch from any to unknown (changed back to any + added a .test_helper suffix exclusion for any)
* Fix Enterprise Search tests/imports
- I checked all application folders but this one, whoops
* PR feedback: comment copy
* Update tests/files added since PR open with new import locations
* Fix misc react router typing
- null not being type-able as a boolean
- forgot to remove various useParam imports after adding mockUseParams
+ misc unused kea import, probably added while debugging kea mocks
# Conflicts:
# x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview.test.tsx
# x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview_logic.test.ts
This commit is contained in:
parent
af18596f63
commit
996903c28f
277 changed files with 596 additions and 446 deletions
|
@ -1374,7 +1374,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',
|
||||
},
|
||||
|
|
|
@ -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,
|
|
@ -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(<SomeComponent />);
|
||||
* });
|
||||
*/
|
||||
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 }));
|
||||
};
|
|
@ -13,6 +13,6 @@ export const mockHttpValues = {
|
|||
readOnlyMode: false,
|
||||
};
|
||||
|
||||
jest.mock('../shared/http', () => ({
|
||||
jest.mock('../../shared/http', () => ({
|
||||
HttpLogic: { values: mockHttpValues },
|
||||
}));
|
|
@ -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 { mockAllValues, mockAllActions, setMockValues, setMockActions } from './hooks.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 { expectedAsyncError } from './expected_async_error';
|
||||
export { LogicMounter } from './logic_mounter.test_helper';
|
|
@ -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 },
|
||||
}));
|
|
@ -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 },
|
||||
}));
|
|
@ -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(<SomeComponent />);
|
||||
* });
|
||||
*/
|
||||
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);
|
|
@ -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 },
|
||||
}));
|
|
@ -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
|
||||
*/
|
|
@ -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
|
|
@ -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: {},
|
||||
};
|
|
@ -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';
|
||||
|
||||
|
|
|
@ -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(<AnalyticsLayout isQueryView title="" />);
|
||||
|
||||
expect(actions.loadQueryData).toHaveBeenCalledWith('test');
|
||||
|
|
|
@ -10,7 +10,7 @@ import {
|
|||
mockKibanaValues,
|
||||
mockHttpValues,
|
||||
mockFlashMessageHelpers,
|
||||
} from '../../../__mocks__';
|
||||
} from '../../../__mocks__/kea_logic';
|
||||
|
||||
jest.mock('../engine', () => ({
|
||||
EngineLogic: { values: { engineName: 'test-engine' } },
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { mockKibanaValues } from '../../../../__mocks__';
|
||||
import { mockKibanaValues } from '../../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { setMockValues, mockKibanaValues } from '../../../../__mocks__';
|
||||
import { setMockValues, mockKibanaValues } from '../../../../__mocks__/kea_logic';
|
||||
|
||||
import React, { ReactElement } from 'react';
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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 './';
|
||||
|
|
|
@ -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', () => {
|
||||
|
|
|
@ -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 './';
|
||||
|
|
|
@ -9,7 +9,7 @@ import {
|
|||
mockHttpValues,
|
||||
mockKibanaValues,
|
||||
mockFlashMessageHelpers,
|
||||
} from '../../../../../../__mocks__';
|
||||
} from '../../../../../../__mocks__/kea_logic';
|
||||
import '../../../../../__mocks__/engine_logic.mock';
|
||||
|
||||
import { ReactWrapper } from 'enzyme';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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(<QueryDetail breadcrumbs={mockBreadcrumbs} />);
|
||||
|
||||
expect(wrapper.find(AnalyticsLayout).prop('title')).toEqual('""');
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { setMockValues } from '../../../../__mocks__';
|
||||
import { setMockValues } from '../../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { setMockValues } from '../../../../__mocks__';
|
||||
import { setMockValues } from '../../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { setMockValues } from '../../../../__mocks__';
|
||||
import { setMockValues } from '../../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { setMockValues } from '../../../../__mocks__';
|
||||
import { setMockValues } from '../../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { setMockValues } from '../../../../__mocks__';
|
||||
import { setMockValues } from '../../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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 './';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
|
@ -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 './';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { setMockValues, setMockActions } from '../../../../__mocks__';
|
||||
import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { setMockValues, setMockActions } from '../../../../__mocks__/kea.mock';
|
||||
import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { setMockValues, setMockActions } from '../../../../__mocks__/kea.mock';
|
||||
import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -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', () => {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { setMockValues, setMockActions } from '../../../../../__mocks__/kea.mock';
|
||||
import { setMockValues, setMockActions } from '../../../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { setMockValues, setMockActions } from '../../../../../__mocks__/kea.mock';
|
||||
import { setMockValues, setMockActions } from '../../../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { setMockValues, setMockActions } from '../../../../../__mocks__/kea.mock';
|
||||
import { setMockValues, setMockActions } from '../../../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { setMockValues } from '../../../../__mocks__/kea.mock';
|
||||
import { setMockValues } from '../../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { setMockActions } from '../../../../__mocks__/kea.mock';
|
||||
import { setMockActions } from '../../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { setMockValues, setMockActions } from '../../../../__mocks__/kea.mock';
|
||||
import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
|
@ -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(<Curation {...props} />);
|
||||
|
||||
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(<Curation {...props} />);
|
||||
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);
|
||||
});
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { setMockValues, setMockActions } from '../../../../../__mocks__';
|
||||
import { setMockValues, setMockActions } from '../../../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { setMockValues, setMockActions } from '../../../../../__mocks__';
|
||||
import { setMockValues, setMockActions } from '../../../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { setMockValues, setMockActions } from '../../../../../__mocks__';
|
||||
import { setMockValues, setMockActions } from '../../../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { setMockValues, setMockActions } from '../../../../../__mocks__';
|
||||
import { setMockValues, setMockActions } from '../../../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { setMockValues, setMockActions } from '../../../../../__mocks__';
|
||||
import { setMockValues, setMockActions } from '../../../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { setMockActions } from '../../../../../__mocks__';
|
||||
import { setMockActions } from '../../../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { setMockActions, setMockValues } from '../../../../../__mocks__';
|
||||
import { setMockActions, setMockValues } from '../../../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { LogicMounter } from '../../../../../__mocks__';
|
||||
import { LogicMounter } from '../../../../../__mocks__/kea_logic';
|
||||
import '../../../../__mocks__/engine_logic.mock';
|
||||
|
||||
import { AddResultLogic } from './';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { setMockActions } from '../../../../__mocks__';
|
||||
import { setMockActions } from '../../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { setMockActions } from '../../../../__mocks__/kea.mock';
|
||||
import { setMockActions } from '../../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { setMockValues } from '../../../../__mocks__/kea.mock';
|
||||
import { setMockValues } from '../../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { setMockValues, setMockActions } from '../../../../__mocks__/kea.mock';
|
||||
import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { setMockValues } from '../../../../__mocks__/kea.mock';
|
||||
import { setMockValues } from '../../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { setMockValues, setMockActions } from '../../../__mocks__/kea.mock';
|
||||
import { setMockValues, setMockActions } from '../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { LogicMounter, mockHttpValues } from '../../../__mocks__';
|
||||
import { LogicMounter, mockHttpValues } from '../../../__mocks__/kea_logic';
|
||||
|
||||
import dedent from 'dedent';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { setMockActions } from '../../../../__mocks__/kea.mock';
|
||||
import { setMockActions } from '../../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -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',
|
||||
}));
|
||||
});
|
||||
|
|
|
@ -10,7 +10,7 @@ import {
|
|||
mockHttpValues,
|
||||
mockKibanaValues,
|
||||
mockFlashMessageHelpers,
|
||||
} from '../../../__mocks__';
|
||||
} from '../../../__mocks__/kea_logic';
|
||||
import { mockEngineValues } from '../../__mocks__';
|
||||
|
||||
import { nextTick } from '@kbn/test/jest';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { LogicMounter } from '../../../__mocks__/kea.mock';
|
||||
import { LogicMounter } from '../../../__mocks__/kea_logic';
|
||||
|
||||
import { DocumentsLogic } from './documents_logic';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { setMockValues, setMockActions } from '../../../../__mocks__';
|
||||
import { setMockValues, setMockActions } from '../../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import '../../../../__mocks__/enterprise_search_url.mock';
|
||||
import { setMockValues } from '../../../../__mocks__';
|
||||
import { setMockValues } from '../../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { LogicMounter, mockHttpValues } from '../../../__mocks__';
|
||||
import { LogicMounter, mockHttpValues } from '../../../__mocks__/kea_logic';
|
||||
|
||||
import { nextTick } from '@kbn/test/jest';
|
||||
|
||||
|
|
|
@ -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', () => {
|
||||
|
|
|
@ -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(<EngineRouter />);
|
||||
expect(wrapper.find(Loading)).toHaveLength(1);
|
||||
});
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { setMockActions, setMockValues } from '../../../__mocks__';
|
||||
import { setMockActions, setMockValues } from '../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import {
|
|||
mockHttpValues,
|
||||
mockKibanaValues,
|
||||
mockFlashMessageHelpers,
|
||||
} from '../../../__mocks__';
|
||||
} from '../../../__mocks__/kea_logic';
|
||||
|
||||
import { nextTick } from '@kbn/test/jest';
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { setMockValues } from '../../../../__mocks__/kea.mock';
|
||||
import { setMockValues } from '../../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
|
@ -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' } },
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import '../../../../__mocks__/enterprise_search_url.mock';
|
||||
import { mockTelemetryActions } from '../../../../__mocks__';
|
||||
import { mockTelemetryActions } from '../../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { mockKibanaValues, mockTelemetryActions } from '../../../../../__mocks__';
|
||||
import { mockKibanaValues, mockTelemetryActions } from '../../../../../__mocks__/kea_logic';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue