polyfill window.matchMedia in jsdom (#181710)

This commit is contained in:
Anton Dosov 2024-04-30 14:26:29 +02:00 committed by GitHub
parent 6eba59575e
commit cb09b55283
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
147 changed files with 25 additions and 307 deletions

View file

@ -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(),
})),
});
}
}

View file

@ -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' },

View file

@ -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: {

View file

@ -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', () => {

View file

@ -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 }) => (

View file

@ -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(),
}));

View file

@ -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,

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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 '.';

View file

@ -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', () => {

View file

@ -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';

View file

@ -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';

View file

@ -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;

View file

@ -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(() => {

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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,

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -8,7 +8,6 @@
import React from 'react';
import { shallow } from 'enzyme';
import '../../mock/match_media';
import {
RowItemOverflowComponent,
OverflowFieldComponent,

View file

@ -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';

View file

@ -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';

View file

@ -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(),
};
});

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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,

View file

@ -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';

View file

@ -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';

View file

@ -5,7 +5,6 @@
* 2.0.
*/
import '../../../../common/mock/match_media';
import {
DEFAULT_ICON,
EXTERNAL,

View file

@ -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';

View file

@ -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,

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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', () => {

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -7,7 +7,6 @@
import React from 'react';
import '../../../../common/mock/match_media';
import { TestProviders } from '../../../../common/mock';
import { UsersTable } from '.';

View file

@ -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';

View file

@ -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 {

View file

@ -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';

View file

@ -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 '.';

View file

@ -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';

View file

@ -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 '.';

View file

@ -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 '.';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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 '.';

View file

@ -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';

View file

@ -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 {

View file

@ -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 '.';

View file

@ -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,

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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 '.';

View file

@ -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';

View file

@ -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';

View file

@ -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 '.';

View file

@ -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 '.';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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 '.';

View file

@ -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