mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
polyfill window.matchMedia in jsdom (#181710)
This commit is contained in:
parent
6eba59575e
commit
cb09b55283
147 changed files with 25 additions and 307 deletions
|
@ -46,4 +46,28 @@ if (!global.hasOwnProperty('Worker')) {
|
|||
}
|
||||
|
||||
global.Worker = Worker;
|
||||
|
||||
// Mocking matchMedia to resolve TypeError: window.matchMedia is not a function
|
||||
// For more info, see https://jestjs.io/docs/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom
|
||||
if (!global.hasOwnProperty('matchMedia')) {
|
||||
Object.defineProperty(global, 'matchMedia', {
|
||||
writable: true,
|
||||
// eslint-disable-next-line no-undef
|
||||
value: jest.fn().mockImplementation((query) => ({
|
||||
matches: false,
|
||||
media: query,
|
||||
onchange: null,
|
||||
// eslint-disable-next-line no-undef
|
||||
addListener: jest.fn(), // deprecated
|
||||
// eslint-disable-next-line no-undef
|
||||
removeListener: jest.fn(), // deprecated
|
||||
// eslint-disable-next-line no-undef
|
||||
addEventListener: jest.fn(),
|
||||
// eslint-disable-next-line no-undef
|
||||
removeEventListener: jest.fn(),
|
||||
// eslint-disable-next-line no-undef
|
||||
dispatchEvent: jest.fn(),
|
||||
})),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,23 +59,7 @@ describe('TextBasedLanguagesEditor', () => {
|
|||
);
|
||||
}
|
||||
let props: TextBasedLanguagesEditorProps;
|
||||
beforeAll(() => {
|
||||
// Mocking matchMedia to resolve TypeError: window.matchMedia is not a function
|
||||
// For more info, see https://jestjs.io/docs/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom
|
||||
Object.defineProperty(window, 'matchMedia', {
|
||||
writable: true,
|
||||
value: jest.fn().mockImplementation((query) => ({
|
||||
matches: false,
|
||||
media: query,
|
||||
onchange: null,
|
||||
addListener: jest.fn(), // deprecated
|
||||
removeListener: jest.fn(), // deprecated
|
||||
addEventListener: jest.fn(),
|
||||
removeEventListener: jest.fn(),
|
||||
dispatchEvent: jest.fn(),
|
||||
})),
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
props = {
|
||||
query: { esql: 'from test' },
|
||||
|
|
|
@ -38,16 +38,6 @@ jest.mock('@kbn/code-editor', () => {
|
|||
};
|
||||
});
|
||||
|
||||
window.matchMedia = jest.fn().mockImplementation((query) => {
|
||||
return {
|
||||
matches: false,
|
||||
media: query,
|
||||
onchange: null,
|
||||
addListener: jest.fn(),
|
||||
removeListener: jest.fn(),
|
||||
};
|
||||
});
|
||||
|
||||
const mockServices = {
|
||||
settings: {
|
||||
client: {
|
||||
|
|
|
@ -23,16 +23,6 @@ import type { ColumnHeaderOptions } from '../../../common/types';
|
|||
import { defaultHeaders } from '../../../store/data_table/defaults';
|
||||
import { mockBrowserFields } from '../../../mock/mock_source';
|
||||
|
||||
window.matchMedia = jest.fn().mockImplementation((query) => {
|
||||
return {
|
||||
matches: false,
|
||||
media: query,
|
||||
onchange: null,
|
||||
addListener: jest.fn(),
|
||||
removeListener: jest.fn(),
|
||||
};
|
||||
});
|
||||
|
||||
describe('helpers', () => {
|
||||
describe('getColumnWidthFromType', () => {
|
||||
test('it returns the expected width for a non-date column', () => {
|
||||
|
|
|
@ -48,15 +48,6 @@ jest.mock('../../hooks/use_selector', () => ({
|
|||
useDeepEqualSelector: () => mockGlobalState.dataTable.tableById['table-test'],
|
||||
}));
|
||||
|
||||
window.matchMedia = jest.fn().mockImplementation((query) => {
|
||||
return {
|
||||
matches: false,
|
||||
media: query,
|
||||
onchange: null,
|
||||
addListener: jest.fn(),
|
||||
removeListener: jest.fn(),
|
||||
};
|
||||
});
|
||||
const dataViewId = 'security-solution-default';
|
||||
|
||||
export const TestCellRenderer: React.FC<DeprecatedCellValueElementProps> = ({ columnId, data }) => (
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
// TODO(jbudz): should be removed when upgrading to TS@4.8
|
||||
// this is a skip for the errors created when typechecking with isolatedModules
|
||||
export {};
|
||||
|
||||
window.matchMedia = jest.fn().mockImplementation((query) => ({
|
||||
matches: false,
|
||||
media: query,
|
||||
onchange: null,
|
||||
addListener: jest.fn(), // deprecated
|
||||
removeListener: jest.fn(), // deprecated
|
||||
addEventListener: jest.fn(),
|
||||
removeEventListener: jest.fn(),
|
||||
}));
|
|
@ -12,7 +12,6 @@ import { renderHook } from '@testing-library/react-hooks';
|
|||
import userEvent from '@testing-library/user-event';
|
||||
import { waitForEuiPopoverOpen } from '@elastic/eui/lib/test/rtl';
|
||||
|
||||
import '../../common/mock/match_media';
|
||||
import type { AppMockRenderer } from '../../common/mock';
|
||||
import {
|
||||
createAppMockRenderer,
|
||||
|
|
|
@ -9,7 +9,6 @@ import React from 'react';
|
|||
import { mount } from 'enzyme';
|
||||
import { licensingMock } from '@kbn/licensing-plugin/public/mocks';
|
||||
|
||||
import '../../common/mock/match_media';
|
||||
import type { GetCasesColumn } from './use_cases_columns';
|
||||
import { ExternalServiceColumn, useCasesColumns } from './use_cases_columns';
|
||||
import { useGetCasesMockState } from '../../containers/mock';
|
||||
|
|
|
@ -9,7 +9,6 @@ import React from 'react';
|
|||
import { waitFor, screen } from '@testing-library/react';
|
||||
import type { AppMockRenderer } from '../../common/mock';
|
||||
import { createAppMockRenderer } from '../../common/mock';
|
||||
import '../../common/mock/match_media';
|
||||
import { useUrlParams } from '../../common/navigation/hooks';
|
||||
import { CaseViewPage } from './case_view_page';
|
||||
import { caseData, caseViewProps } from './mocks';
|
||||
|
|
|
@ -14,7 +14,6 @@ import type { UseGetCase } from '../../containers/use_get_case';
|
|||
import type { CaseViewTabsProps } from './case_view_tabs';
|
||||
|
||||
import { CASE_VIEW_PAGE_TABS } from '../../../common/types';
|
||||
import '../../common/mock/match_media';
|
||||
import { createAppMockRenderer } from '../../common/mock';
|
||||
import { useCaseViewNavigation } from '../../common/navigation/hooks';
|
||||
import { useGetCase } from '../../containers/use_get_case';
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
import React from 'react';
|
||||
|
||||
import '../../common/mock/match_media';
|
||||
import type { CaseViewProps } from './types';
|
||||
import { connectorsMock } from '../../containers/mock';
|
||||
import type { SpacesApi } from '@kbn/spaces-plugin/public';
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
import React from 'react';
|
||||
|
||||
import '../../common/mock/match_media';
|
||||
import type { AppMockRenderer } from '../../common/mock';
|
||||
import { createAppMockRenderer, readCasesPermissions, TestProviders } from '../../common/mock';
|
||||
import type { EditableTitleProps } from './editable_title';
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
import React from 'react';
|
||||
|
||||
import '../../common/mock/match_media';
|
||||
import type { AppMockRenderer } from '../../common/mock';
|
||||
import { createAppMockRenderer, TestProviders } from '../../common/mock';
|
||||
import { HeaderPage } from '.';
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
import React from 'react';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
|
||||
import '../../common/mock/match_media';
|
||||
import { Title } from './title';
|
||||
|
||||
describe('Title', () => {
|
||||
|
|
|
@ -12,7 +12,6 @@ import { render, screen } from '@testing-library/react';
|
|||
import userEvent from '@testing-library/user-event';
|
||||
import { EuiText } from '@elastic/eui';
|
||||
|
||||
import '../../common/mock/match_media';
|
||||
import type { ConfigureCaseButtonProps, CaseDetailsLinkProps } from '.';
|
||||
import { ConfigureCaseButton, CaseDetailsLink } from '.';
|
||||
import { TestProviders } from '../../common/mock';
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
import React from 'react';
|
||||
import { renderHook, act } from '@testing-library/react-hooks';
|
||||
|
||||
import '../../common/mock/match_media';
|
||||
import type { ReturnUsePushToService, UsePushToService } from '.';
|
||||
import { usePushToService } from '.';
|
||||
import { noPushCasesPermissions, readCasesPermissions, TestProviders } from '../../common/mock';
|
||||
|
|
|
@ -21,20 +21,6 @@ import '@kbn/code-editor-mock/jest_helper';
|
|||
// @ts-ignore-next
|
||||
window.Worker = Worker;
|
||||
|
||||
Object.defineProperty(window, 'matchMedia', {
|
||||
writable: true,
|
||||
value: jest.fn().mockImplementation((query) => ({
|
||||
matches: false,
|
||||
media: query,
|
||||
onchange: null,
|
||||
addListener: jest.fn(), // Deprecated
|
||||
removeListener: jest.fn(), // Deprecated
|
||||
addEventListener: jest.fn(),
|
||||
removeEventListener: jest.fn(),
|
||||
dispatchEvent: jest.fn(),
|
||||
})),
|
||||
});
|
||||
|
||||
interface CloudDefendAppDeps {
|
||||
core: CoreStart;
|
||||
deps: CloudDefendPluginStartDeps;
|
||||
|
|
|
@ -50,22 +50,6 @@ describe('<TemplateClone />', () => {
|
|||
httpRequestsMockHelpers.setLoadTelemetryResponse({});
|
||||
httpRequestsMockHelpers.setLoadComponentTemplatesResponse([]);
|
||||
httpRequestsMockHelpers.setLoadTemplateResponse(templateToClone.name, templateToClone);
|
||||
|
||||
// Mocking matchMedia to resolve TypeError: window.matchMedia is not a function
|
||||
// For more info, see https://jestjs.io/docs/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom
|
||||
Object.defineProperty(window, 'matchMedia', {
|
||||
writable: true,
|
||||
value: jest.fn().mockImplementation((query) => ({
|
||||
matches: false,
|
||||
media: query,
|
||||
onchange: null,
|
||||
addListener: jest.fn(), // deprecated
|
||||
removeListener: jest.fn(), // deprecated
|
||||
addEventListener: jest.fn(),
|
||||
removeEventListener: jest.fn(),
|
||||
dispatchEvent: jest.fn(),
|
||||
})),
|
||||
});
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
|
|
|
@ -13,7 +13,6 @@ import React from 'react';
|
|||
|
||||
import { escapeDataProviderId } from '../drag_and_drop/helpers';
|
||||
import { TestProviders } from '../../mock';
|
||||
import '../../mock/match_media';
|
||||
import '../../mock/react_beautiful_dnd';
|
||||
|
||||
import { BarChartBaseComponent, BarChartComponent } from './barchart';
|
||||
|
|
|
@ -9,7 +9,6 @@ import type { ReactWrapper } from 'enzyme';
|
|||
import { mount } from 'enzyme';
|
||||
import React from 'react';
|
||||
|
||||
import '../../mock/match_media';
|
||||
import '../../mock/react_beautiful_dnd';
|
||||
import { TestProviders } from '../../mock';
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ import type { ReactWrapper } from 'enzyme';
|
|||
import { mount } from 'enzyme';
|
||||
import React from 'react';
|
||||
|
||||
import '../../mock/match_media';
|
||||
import '../../mock/react_beautiful_dnd';
|
||||
import { TestProviders } from '../../mock';
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ import { shallow } from 'enzyme';
|
|||
import React from 'react';
|
||||
import type { DraggableStateSnapshot, DraggingStyle } from '@hello-pangea/dnd';
|
||||
|
||||
import '../../mock/match_media';
|
||||
import { mockBrowserFields } from '../../containers/source/mock';
|
||||
import { TestProviders } from '../../mock';
|
||||
import { mockDataProviders } from '../../../timelines/components/timeline/data_providers/mock/mock_data_providers';
|
||||
|
|
|
@ -11,7 +11,6 @@ import { EuiToolTip } from '@elastic/eui';
|
|||
|
||||
import { DRAGGABLE_KEYBOARD_INSTRUCTIONS_NOT_DRAGGING_SCREEN_READER_ONLY } from '../drag_and_drop/translations';
|
||||
import { TestProviders } from '../../mock';
|
||||
import '../../mock/match_media';
|
||||
import { getEmptyString } from '../empty_value';
|
||||
import { useMountAppended } from '../../utils/use_mount_appended';
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ import { mount } from 'enzyme';
|
|||
import type { ReactWrapper } from 'enzyme';
|
||||
import React from 'react';
|
||||
|
||||
import '../../mock/match_media';
|
||||
import '../../mock/react_beautiful_dnd';
|
||||
import {
|
||||
mockDetailItemData,
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
import React from 'react';
|
||||
|
||||
import '../../mock/match_media';
|
||||
import { mockDetailItemData, mockDetailItemDataId } from '../../mock/mock_detail_item';
|
||||
import { TestProviders } from '../../mock/test_providers';
|
||||
import { EventFieldsBrowser } from './event_fields_browser';
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
import React from 'react';
|
||||
import useResizeObserver from 'use-resize-observer/polyfilled';
|
||||
|
||||
import '../../mock/match_media';
|
||||
import { render } from '@testing-library/react';
|
||||
import { TestProviders } from '../../mock';
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ import type { ReactWrapper } from 'enzyme';
|
|||
import { mount, shallow } from 'enzyme';
|
||||
import React from 'react';
|
||||
|
||||
import '../../mock/match_media';
|
||||
import { FiltersGlobal } from './filters_global';
|
||||
import { TestProviders } from '../../mock/test_providers';
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
import { shallow } from 'enzyme';
|
||||
import React from 'react';
|
||||
|
||||
import '../../mock/match_media';
|
||||
import { TestProviders } from '../../mock';
|
||||
import { EditableTitle } from './editable_title';
|
||||
import { useMountAppended } from '../../utils/use_mount_appended';
|
||||
|
|
|
@ -9,7 +9,6 @@ import { euiDarkVars } from '@kbn/ui-theme';
|
|||
import { shallow } from 'enzyme';
|
||||
import React from 'react';
|
||||
|
||||
import '../../mock/match_media';
|
||||
import { TestProviders } from '../../mock';
|
||||
import { HeaderPage } from '.';
|
||||
import { useMountAppended } from '../../utils/use_mount_appended';
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
import { shallow } from 'enzyme';
|
||||
import React from 'react';
|
||||
|
||||
import '../../mock/match_media';
|
||||
import { TestProviders } from '../../mock';
|
||||
import { Title } from './title';
|
||||
import { useMountAppended } from '../../utils/use_mount_appended';
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
|
||||
import '../../mock/match_media';
|
||||
import { EntityComponent } from './entity';
|
||||
import { TestProviders } from '../../mock/test_providers';
|
||||
import { useMountAppended } from '../../utils/use_mount_appended';
|
||||
|
|
|
@ -9,7 +9,6 @@ import { shallow } from 'enzyme';
|
|||
import { cloneDeep } from 'lodash/fp';
|
||||
import React from 'react';
|
||||
|
||||
import '../../../mock/match_media';
|
||||
import { AnomalyScoreComponent } from './anomaly_score';
|
||||
import { mockAnomalies } from '../mock';
|
||||
import { TestProviders } from '../../../mock/test_providers';
|
||||
|
|
|
@ -9,7 +9,6 @@ import { shallow } from 'enzyme';
|
|||
import { cloneDeep } from 'lodash/fp';
|
||||
import React from 'react';
|
||||
|
||||
import '../../../mock/match_media';
|
||||
import { AnomalyScoresComponent, createJobKey } from './anomaly_scores';
|
||||
import { mockAnomalies } from '../mock';
|
||||
import { TestProviders } from '../../../mock/test_providers';
|
||||
|
|
|
@ -9,7 +9,6 @@ import React from 'react';
|
|||
import { cloneDeep } from 'lodash/fp';
|
||||
import { shallow } from 'enzyme';
|
||||
|
||||
import '../../../mock/match_media';
|
||||
import { ScoreComponent } from './score';
|
||||
import { mockAnomalies } from '../mock';
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import '../../../mock/match_media';
|
||||
import { getAnomaliesHostTableColumnsCurated } from './get_anomalies_host_table_columns';
|
||||
import { HostsType } from '../../../../explore/hosts/store/model';
|
||||
import * as i18n from './translations';
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import '../../../mock/match_media';
|
||||
import { getAnomaliesNetworkTableColumnsCurated } from './get_anomalies_network_table_columns';
|
||||
import { NetworkType } from '../../../../explore/network/store/model';
|
||||
import * as i18n from './translations';
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import '../../../mock/match_media';
|
||||
import * as i18n from './translations';
|
||||
import type { AnomaliesBy, Anomaly } from '../types';
|
||||
import type { Columns } from '../../../../explore/components/paginated_table';
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
*/
|
||||
|
||||
import { UsersType } from '../../../../explore/users/store/model';
|
||||
import '../../../mock/match_media';
|
||||
import { getAnomaliesUserTableColumnsCurated } from './get_anomalies_user_table_columns';
|
||||
|
||||
import * as i18n from './translations';
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
|
||||
import '../../mock/match_media';
|
||||
import {
|
||||
RowItemOverflowComponent,
|
||||
OverflowFieldComponent,
|
||||
|
|
|
@ -9,7 +9,6 @@ import type { ReactWrapper } from 'enzyme';
|
|||
import { mount } from 'enzyme';
|
||||
import React from 'react';
|
||||
import { waitFor } from '@testing-library/react';
|
||||
import '../../mock/match_media';
|
||||
import { mockBrowserFields } from '../../containers/source/mock';
|
||||
import { mockGlobalState, TestProviders, mockIndexPattern, createMockStore } from '../../mock';
|
||||
import type { State } from '../../store';
|
||||
|
|
|
@ -10,7 +10,6 @@ import { mount } from 'enzyme';
|
|||
import React from 'react';
|
||||
import { waitFor } from '@testing-library/react';
|
||||
|
||||
import '../../mock/match_media';
|
||||
import { TestProviders, mockIndexPattern } from '../../mock';
|
||||
|
||||
import { allEvents, defaultOptions } from './helpers';
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
// TODO(jbudz): should be removed when upgrading to TS@4.8
|
||||
// this is a skip for the errors created when typechecking with isolatedModules
|
||||
export {};
|
||||
|
||||
window.matchMedia = jest.fn().mockImplementation((query) => {
|
||||
return {
|
||||
matches: false,
|
||||
media: query,
|
||||
onchange: null,
|
||||
addListener: jest.fn(), // deprecated
|
||||
removeListener: jest.fn(), // deprecated
|
||||
addEventListener: jest.fn(),
|
||||
removeEventListener: jest.fn(),
|
||||
};
|
||||
});
|
|
@ -5,7 +5,6 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import '../../mock/match_media';
|
||||
import { defaultHeaders, createSecuritySolutionStorageMock, createMockStore } from '../../mock';
|
||||
import { addTableInStorage } from '../../../timelines/containers/local_storage';
|
||||
import { Direction } from '../../../../common/search_strategy';
|
||||
|
|
|
@ -10,7 +10,6 @@ import { fireEvent, render, within } from '@testing-library/react';
|
|||
import type { Filter } from '@kbn/es-query';
|
||||
import useResizeObserver from 'use-resize-observer/polyfilled';
|
||||
|
||||
import '../../../common/mock/match_media';
|
||||
import { createMockStore, mockGlobalState, TestProviders } from '../../../common/mock';
|
||||
import type { AlertsTableComponentProps } from './alerts_grouping';
|
||||
import { GroupedAlertsTable } from './alerts_grouping';
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
import React, { useEffect } from 'react';
|
||||
import { render, waitFor } from '@testing-library/react';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import '../../../common/mock/match_media';
|
||||
import { mockGlobalState, TestProviders, createMockStore } from '../../../common/mock';
|
||||
import { useUserData } from '../../components/user_info';
|
||||
import { useSourcererDataView } from '../../../common/containers/sourcerer';
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
import React from 'react';
|
||||
import { render } from '@testing-library/react';
|
||||
import '../../../common/mock/match_media';
|
||||
|
||||
import * as i18n from './translations';
|
||||
import { AuthenticationsHostTable } from './authentications_host_table';
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
import React from 'react';
|
||||
import { render } from '@testing-library/react';
|
||||
import '../../../common/mock/match_media';
|
||||
|
||||
import { TestProviders } from '../../../common/mock';
|
||||
import { useAuthentications } from '../../containers/authentications';
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
import { shallow } from 'enzyme';
|
||||
import React from 'react';
|
||||
|
||||
import '../../../../common/mock/match_media';
|
||||
import { TestProviders, createMockStore } from '../../../../common/mock';
|
||||
import { useMountAppended } from '../../../../common/utils/use_mount_appended';
|
||||
import { hostsModel } from '../../store';
|
||||
|
|
|
@ -10,7 +10,6 @@ import { getOr } from 'lodash/fp';
|
|||
import React from 'react';
|
||||
|
||||
import { TestProviders } from '../../../../common/mock';
|
||||
import '../../../../common/mock/match_media';
|
||||
import { hostsModel } from '../../store';
|
||||
import { getEmptyValue } from '../../../../common/components/empty_value';
|
||||
import { useMountAppended } from '../../../../common/utils/use_mount_appended';
|
||||
|
|
|
@ -9,7 +9,6 @@ import React from 'react';
|
|||
import { MemoryRouter } from 'react-router-dom';
|
||||
import useResizeObserver from 'use-resize-observer/polyfilled';
|
||||
|
||||
import '../../../../common/mock/match_media';
|
||||
import {
|
||||
createMockStore,
|
||||
mockGlobalState,
|
||||
|
|
|
@ -10,7 +10,6 @@ import React from 'react';
|
|||
import { Router } from '@kbn/shared-ux-router';
|
||||
|
||||
import type { Filter } from '@kbn/es-query';
|
||||
import '../../../common/mock/match_media';
|
||||
import { TestProviders, createMockStore } from '../../../common/mock';
|
||||
import { TabNavigation } from '../../../common/components/navigation/tab_navigation';
|
||||
import { inputsActions } from '../../../common/store/inputs';
|
||||
|
|
|
@ -9,7 +9,6 @@ import { shallow } from 'enzyme';
|
|||
import React from 'react';
|
||||
import type { ActionCreator } from 'typescript-fsa';
|
||||
|
||||
import '../../../../common/mock/match_media';
|
||||
import { TestProviders } from '../../../../common/mock';
|
||||
import { networkModel } from '../../store';
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import '../../../../common/mock/match_media';
|
||||
import {
|
||||
DEFAULT_ICON,
|
||||
EXTERNAL,
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
import { render, waitFor } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import '../../../../common/mock/match_media';
|
||||
import { TestProviders, mockGlobalState, createMockStore } from '../../../../common/mock';
|
||||
|
||||
import { EmbeddedMapComponent } from './embedded_map';
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
import { shallow } from 'enzyme';
|
||||
import React from 'react';
|
||||
|
||||
import '../../../../../common/mock/match_media';
|
||||
import { LineToolTipContentComponent } from './line_tool_tip_content';
|
||||
import {
|
||||
SUM_OF_CLIENT_BYTES,
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
import { shallow } from 'enzyme';
|
||||
import React from 'react';
|
||||
import '../../../../../common/mock/match_media';
|
||||
import { MapToolTipComponent } from './map_tool_tip';
|
||||
import type { TooltipFeature } from '@kbn/maps-plugin/common';
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
import { shallow } from 'enzyme';
|
||||
import React from 'react';
|
||||
|
||||
import '../../../../../common/mock/match_media';
|
||||
import { getRenderedFieldValue, PointToolTipContentComponent } from './point_tool_tip_content';
|
||||
import { TestProviders } from '../../../../../common/mock';
|
||||
import { getEmptyStringTag } from '../../../../../common/components/empty_value';
|
||||
|
|
|
@ -9,7 +9,6 @@ import { mount } from 'enzyme';
|
|||
import React from 'react';
|
||||
import { MemoryRouter } from 'react-router-dom';
|
||||
|
||||
import '../../../../common/mock/match_media';
|
||||
import { TestProviders } from '../../../../common/mock';
|
||||
import { FlowTargetSelectConnectedComponent } from '.';
|
||||
import { FlowTarget } from '../../../../../common/search_strategy';
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
import { shallow } from 'enzyme';
|
||||
import React from 'react';
|
||||
|
||||
import '../../../../common/mock/match_media';
|
||||
import { TestProviders } from '../../../../common/mock/test_providers';
|
||||
import { useMountAppended } from '../../../../common/utils/use_mount_appended';
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ import React from 'react';
|
|||
import { Provider as ReduxStoreProvider } from 'react-redux';
|
||||
|
||||
import { createMockStore } from '../../../../common/mock';
|
||||
import '../../../../common/mock/match_media';
|
||||
import { NetworkKpiComponent } from '.';
|
||||
|
||||
describe('NetworkKpiComponent', () => {
|
||||
|
|
|
@ -10,7 +10,6 @@ import { getOr } from 'lodash/fp';
|
|||
import React from 'react';
|
||||
import { Provider as ReduxStoreProvider } from 'react-redux';
|
||||
|
||||
import '../../../../common/mock/match_media';
|
||||
import { TestProviders, createMockStore } from '../../../../common/mock';
|
||||
import { networkModel } from '../../store';
|
||||
import { useMountAppended } from '../../../../common/utils/use_mount_appended';
|
||||
|
|
|
@ -10,7 +10,6 @@ import { getOr } from 'lodash/fp';
|
|||
import React from 'react';
|
||||
import { Provider as ReduxStoreProvider } from 'react-redux';
|
||||
|
||||
import '../../../../common/mock/match_media';
|
||||
import { TestProviders, createMockStore } from '../../../../common/mock';
|
||||
import { useMountAppended } from '../../../../common/utils/use_mount_appended';
|
||||
import { networkModel } from '../../store';
|
||||
|
|
|
@ -10,7 +10,6 @@ import { getOr } from 'lodash/fp';
|
|||
import React from 'react';
|
||||
import { Provider as ReduxStoreProvider } from 'react-redux';
|
||||
|
||||
import '../../../../common/mock/match_media';
|
||||
import { FlowTargetSourceDest } from '../../../../../common/search_strategy/security_solution/network';
|
||||
import { mockIndexPattern, TestProviders, createMockStore } from '../../../../common/mock';
|
||||
import { useMountAppended } from '../../../../common/utils/use_mount_appended';
|
||||
|
|
|
@ -9,7 +9,6 @@ import { shallow } from 'enzyme';
|
|||
import React from 'react';
|
||||
import { Provider as ReduxStoreProvider } from 'react-redux';
|
||||
|
||||
import '../../../../common/mock/match_media';
|
||||
import { TestProviders, createMockStore } from '../../../../common/mock';
|
||||
import { useMountAppended } from '../../../../common/utils/use_mount_appended';
|
||||
import { networkModel } from '../../store';
|
||||
|
|
|
@ -9,7 +9,6 @@ import { shallow } from 'enzyme';
|
|||
import React from 'react';
|
||||
|
||||
import { removeExternalLinkText } from '@kbn/securitysolution-io-ts-utils';
|
||||
import '../../../../common/mock/match_media';
|
||||
import { TestProviders } from '../../../../common/mock/test_providers';
|
||||
import { useMountAppended } from '../../../../common/utils/use_mount_appended';
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ import { render, screen, within } from '@testing-library/react';
|
|||
|
||||
import { asArrayIfExists } from '../../../../common/lib/helpers';
|
||||
import { getMockNetflowData } from '../../../../common/mock';
|
||||
import '../../../../common/mock/match_media';
|
||||
import { TestProviders } from '../../../../common/mock/test_providers';
|
||||
import { ID_FIELD_NAME } from '../../../../common/components/event_details/event_id';
|
||||
import { DESTINATION_IP_FIELD_NAME, SOURCE_IP_FIELD_NAME } from '../ip';
|
||||
|
|
|
@ -11,7 +11,6 @@ import { render, screen } from '@testing-library/react';
|
|||
|
||||
import { asArrayIfExists } from '../../../../common/lib/helpers';
|
||||
import { getMockNetflowData } from '../../../../common/mock';
|
||||
import '../../../../common/mock/match_media';
|
||||
import { TestProviders } from '../../../../common/mock/test_providers';
|
||||
import { ID_FIELD_NAME } from '../../../../common/components/event_details/event_id';
|
||||
import { DESTINATION_IP_FIELD_NAME, SOURCE_IP_FIELD_NAME } from '../ip';
|
||||
|
|
|
@ -10,7 +10,6 @@ import { getOr } from 'lodash/fp';
|
|||
import React from 'react';
|
||||
import { Provider as ReduxStoreProvider } from 'react-redux';
|
||||
|
||||
import '../../../../common/mock/match_media';
|
||||
import { TestProviders, createMockStore } from '../../../../common/mock';
|
||||
import { useMountAppended } from '../../../../common/utils/use_mount_appended';
|
||||
import { networkModel } from '../../store';
|
||||
|
|
|
@ -10,7 +10,6 @@ import { getOr } from 'lodash/fp';
|
|||
import React from 'react';
|
||||
import { Provider as ReduxStoreProvider } from 'react-redux';
|
||||
|
||||
import '../../../../common/mock/match_media';
|
||||
import { TestProviders, createMockStore } from '../../../../common/mock';
|
||||
import { useMountAppended } from '../../../../common/utils/use_mount_appended';
|
||||
import { networkModel } from '../../store';
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
import React from 'react';
|
||||
import { Router, useParams } from 'react-router-dom';
|
||||
|
||||
import '../../../../common/mock/match_media';
|
||||
|
||||
import { useSourcererDataView } from '../../../../common/containers/sourcerer';
|
||||
import { TestProviders } from '../../../../common/mock';
|
||||
import { useMountAppended } from '../../../../common/utils/use_mount_appended';
|
||||
|
|
|
@ -9,7 +9,6 @@ import { mount } from 'enzyme';
|
|||
import React from 'react';
|
||||
import { Router } from '@kbn/shared-ux-router';
|
||||
import { waitFor } from '@testing-library/react';
|
||||
import '../../../common/mock/match_media';
|
||||
import type { Filter } from '@kbn/es-query';
|
||||
import { useSourcererDataView } from '../../../common/containers/sourcerer';
|
||||
import { TestProviders, createMockStore } from '../../../common/mock';
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
import React from 'react';
|
||||
|
||||
import '../../../../common/mock/match_media';
|
||||
import { TestProviders } from '../../../../common/mock';
|
||||
|
||||
import { UsersTable } from '.';
|
||||
|
|
|
@ -9,7 +9,6 @@ import { mount } from 'enzyme';
|
|||
import React from 'react';
|
||||
import { Router } from '@kbn/shared-ux-router';
|
||||
|
||||
import '../../../common/mock/match_media';
|
||||
import { TestProviders } from '../../../common/mock';
|
||||
import { TabNavigation } from '../../../common/components/navigation/tab_navigation';
|
||||
import { Users } from './users';
|
||||
|
|
|
@ -9,7 +9,6 @@ import React from 'react';
|
|||
import * as reactTestingLibrary from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { EndpointList } from '.';
|
||||
import '../../../../common/mock/match_media';
|
||||
import { createUseUiSetting$Mock } from '../../../../common/lib/kibana/kibana_react.mock';
|
||||
|
||||
import {
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
import React from 'react';
|
||||
|
||||
import { ManagementContainer } from '..';
|
||||
import '../../../common/mock/match_media';
|
||||
import type { AppContextTestRender } from '../../../common/mock/endpoint';
|
||||
import { createAppRootMockRenderer } from '../../../common/mock/endpoint';
|
||||
import { useUserPrivileges } from '../../../common/components/user_privileges';
|
||||
|
|
|
@ -11,7 +11,6 @@ import React from 'react';
|
|||
import type { OverviewHostProps } from '../overview_host';
|
||||
import type { OverviewNetworkProps } from '../overview_network';
|
||||
import { mockIndexPattern, TestProviders } from '../../../common/mock';
|
||||
import '../../../common/mock/match_media';
|
||||
|
||||
import { EventCounts } from '.';
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
import { mount } from 'enzyme';
|
||||
import React from 'react';
|
||||
|
||||
import '../../../../common/mock/match_media';
|
||||
import '../../../../common/mock/react_beautiful_dnd';
|
||||
import { TestProviders } from '../../../../common/mock';
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
import { shallow } from 'enzyme';
|
||||
import { render } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import '../../../common/mock/match_media';
|
||||
import { TestProviders } from '../../../common/mock';
|
||||
|
||||
import { HostOverview } from '.';
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
import { mount } from 'enzyme';
|
||||
import React from 'react';
|
||||
|
||||
import '../../../common/mock/match_media';
|
||||
import { TestProviders } from '../../../common/mock';
|
||||
|
||||
import { OverviewHost } from '.';
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
import { mount } from 'enzyme';
|
||||
import React from 'react';
|
||||
|
||||
import '../../../common/mock/match_media';
|
||||
import { TestProviders } from '../../../common/mock';
|
||||
import { OverviewNetwork } from '.';
|
||||
import { useNetworkOverview } from '../../containers/overview_network';
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
import { shallow } from 'enzyme';
|
||||
import { render } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import '../../../common/mock/match_media';
|
||||
import { TestProviders } from '../../../common/mock';
|
||||
|
||||
import { mockAnomalies } from '../../../common/components/ml/mock';
|
||||
|
|
|
@ -10,7 +10,6 @@ import React from 'react';
|
|||
import { MemoryRouter } from 'react-router-dom';
|
||||
import { merge } from 'lodash';
|
||||
|
||||
import '../../common/mock/match_media';
|
||||
import { TestProviders } from '../../common/mock';
|
||||
import type { UseMessagesStorage } from '../../common/containers/local_storage/use_messages_storage';
|
||||
import { useMessagesStorage } from '../../common/containers/local_storage/use_messages_storage';
|
||||
|
|
|
@ -9,7 +9,6 @@ import React from 'react';
|
|||
import { render, screen } from '@testing-library/react';
|
||||
|
||||
import { TestProviders } from '../../../common/mock';
|
||||
import '../../../common/mock/match_media';
|
||||
|
||||
import { CertificateFingerprint } from '.';
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
import React from 'react';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
|
||||
import '../../../common/mock/match_media';
|
||||
import { TestProviders } from '../../../common/mock';
|
||||
import { ONE_MILLISECOND_AS_NANOSECONDS } from '../formatted_duration/helpers';
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ import { render, screen } from '@testing-library/react';
|
|||
import userEvent from '@testing-library/user-event';
|
||||
|
||||
import { TestProviders } from '../../../common/mock';
|
||||
import '../../../common/mock/match_media';
|
||||
import { getEmptyValue } from '../../../common/components/empty_value';
|
||||
|
||||
import {
|
||||
|
|
|
@ -9,7 +9,6 @@ import React from 'react';
|
|||
import { render, screen } from '@testing-library/react';
|
||||
|
||||
import { TestProviders } from '../../../common/mock';
|
||||
import '../../../common/mock/match_media';
|
||||
|
||||
import { Ja3Fingerprint } from '.';
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ import React from 'react';
|
|||
import { render, screen, within } from '@testing-library/react';
|
||||
|
||||
import { asArrayIfExists } from '../../../common/lib/helpers';
|
||||
import '../../../common/mock/match_media';
|
||||
import { TestProviders } from '../../../common/mock/test_providers';
|
||||
import {
|
||||
TLS_CLIENT_CERTIFICATE_FINGERPRINT_SHA1_FIELD_NAME,
|
||||
|
|
|
@ -11,7 +11,6 @@ import { mount } from 'enzyme';
|
|||
import { fireEvent, render, waitFor } from '@testing-library/react';
|
||||
import { useHistory, useParams } from 'react-router-dom';
|
||||
|
||||
import '../../../common/mock/match_media';
|
||||
import '../../../common/mock/formatted_relative';
|
||||
import { SecurityPageName } from '../../../app/types';
|
||||
import { TimelineType } from '../../../../common/api/timeline';
|
||||
|
|
|
@ -11,7 +11,6 @@ import React from 'react';
|
|||
import { ThemeProvider } from 'styled-components';
|
||||
import { waitFor } from '@testing-library/react';
|
||||
|
||||
import '../../../common/mock/match_media';
|
||||
import { DEFAULT_SEARCH_RESULTS_PER_PAGE } from '../../pages/timelines_page';
|
||||
import type { OpenTimelineResult, OpenTimelineProps } from './types';
|
||||
import type { TimelinesTableProps } from './timelines_table';
|
||||
|
|
|
@ -10,7 +10,6 @@ import { mountWithIntl } from '@kbn/test-jest-helpers';
|
|||
import React from 'react';
|
||||
import { ThemeProvider } from 'styled-components';
|
||||
|
||||
import '../../../../common/mock/match_media';
|
||||
import { DEFAULT_SEARCH_RESULTS_PER_PAGE } from '../../../pages/timelines_page';
|
||||
import type { OpenTimelineResult, OpenTimelineProps } from '../types';
|
||||
import type { TimelinesTableProps } from '../timelines_table';
|
||||
|
|
|
@ -11,8 +11,6 @@ import { mountWithIntl } from '@kbn/test-jest-helpers';
|
|||
import React from 'react';
|
||||
import { ThemeProvider } from 'styled-components';
|
||||
|
||||
import '../../../../common/mock/match_media';
|
||||
|
||||
import { mockTimelineResults } from '../../../../common/mock/timeline_results';
|
||||
import type { OpenTimelineResult } from '../types';
|
||||
import type { TimelinesTableProps } from '.';
|
||||
|
|
|
@ -12,7 +12,6 @@ import { ThemeProvider } from 'styled-components';
|
|||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
import { mountWithIntl } from '@kbn/test-jest-helpers';
|
||||
|
||||
import '../../../../common/mock/match_media';
|
||||
import '../../../../common/mock/formatted_relative';
|
||||
import { getEmptyValue } from '../../../../common/components/empty_value';
|
||||
import type { OpenTimelineResult } from '../types';
|
||||
|
|
|
@ -10,7 +10,6 @@ import { mountWithIntl } from '@kbn/test-jest-helpers';
|
|||
import React from 'react';
|
||||
import { ThemeProvider } from 'styled-components';
|
||||
|
||||
import '../../../../common/mock/match_media';
|
||||
import { getEmptyValue } from '../../../../common/components/empty_value';
|
||||
import { mockTimelineResults } from '../../../../common/mock/timeline_results';
|
||||
import type { OpenTimelineResult } from '../types';
|
||||
|
|
|
@ -10,7 +10,6 @@ import { mountWithIntl } from '@kbn/test-jest-helpers';
|
|||
import React from 'react';
|
||||
import { ThemeProvider } from 'styled-components';
|
||||
|
||||
import '../../../../common/mock/match_media';
|
||||
import { mockTimelineResults } from '../../../../common/mock/timeline_results';
|
||||
import type { TimelinesTableProps } from '.';
|
||||
import { TimelinesTable } from '.';
|
||||
|
|
|
@ -10,7 +10,6 @@ import { mountWithIntl } from '@kbn/test-jest-helpers';
|
|||
import React from 'react';
|
||||
import { ThemeProvider } from 'styled-components';
|
||||
|
||||
import '../../../../common/mock/match_media';
|
||||
import { mockTimelineResults } from '../../../../common/mock/timeline_results';
|
||||
import type { OpenTimelineResult } from '../types';
|
||||
import type { TimelinesTableProps } from '.';
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
import React from 'react';
|
||||
import { render } from '@testing-library/react';
|
||||
import { FlyoutFooter } from './footer';
|
||||
import '../../../../../common/mock/match_media';
|
||||
import { TestProviders } from '../../../../../common/mock';
|
||||
import { TimelineId } from '../../../../../../common/types/timeline';
|
||||
import type { EcsSecurityExtension as Ecs } from '@kbn/securitysolution-ecs';
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
import React from 'react';
|
||||
import { render } from '@testing-library/react';
|
||||
import { EventDetailsPanel } from '.';
|
||||
import '../../../../common/mock/match_media';
|
||||
import { TestProviders } from '../../../../common/mock';
|
||||
import { TimelineId, TimelineTabs } from '../../../../../common/types/timeline';
|
||||
import type { EcsSecurityExtension as Ecs } from '@kbn/securitysolution-ecs';
|
||||
|
|
|
@ -9,7 +9,6 @@ import { mount } from 'enzyme';
|
|||
import { waitFor } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
|
||||
import '../../../../common/mock/match_media';
|
||||
import { mockGlobalState, TestProviders } from '../../../../common/mock';
|
||||
import { ExpandableHostDetails } from './expandable_host';
|
||||
import { mockAnomalies } from '../../../../common/components/ml/mock';
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
import { mount } from 'enzyme';
|
||||
import React from 'react';
|
||||
|
||||
import '../../../common/mock/match_media';
|
||||
import { mockGlobalState, TestProviders, createMockStore } from '../../../common/mock';
|
||||
import type { State } from '../../../common/store';
|
||||
import { DetailsPanel } from '.';
|
||||
|
|
|
@ -9,7 +9,6 @@ import { mount } from 'enzyme';
|
|||
import { waitFor } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
|
||||
import '../../../../common/mock/match_media';
|
||||
import { mockGlobalState, TestProviders } from '../../../../common/mock';
|
||||
import { ExpandableUserDetails } from './expandable_user';
|
||||
import { mockAnomalies } from '../../../../common/components/ml/mock';
|
||||
|
|
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