Skip to content

Commit

Permalink
fix more imports
Browse files Browse the repository at this point in the history
  • Loading branch information
stephmilovic committed Dec 12, 2022
1 parent 9a25f82 commit 29f66c1
Show file tree
Hide file tree
Showing 97 changed files with 185 additions and 186 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { EuiLoadingSpinner, EuiPanel } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import * as i18n from './translations';
import { EnrichedDataRow, ThreatSummaryPanelHeader } from './threat_summary_view';
import { RiskScore } from '../../../../explore/risk_score/components/severity/common';
import { RiskScore } from '../../../../explore/components/risk_score/severity/common';
import type { RiskSeverity } from '../../../../../common/search_strategy';
import { RiskScoreEntity } from '../../../../../common/search_strategy';
import type { HostRisk, UserRisk } from '../../../../explore/containers/risk_score';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { useRiskScore } from '../../../explore/containers/risk_score';
import { useBasicDataFromDetailsData } from '../../../timelines/components/side_panel/event_details/helpers';
import { RiskScoreEntity } from '../../../../common/search_strategy';

jest.mock('../../../risk_score/containers');
jest.mock('../../../explore/containers/risk_score');
jest.mock('../../../timelines/components/side_panel/event_details/helpers');
const mockUseRiskScore = useRiskScore as jest.Mock;
const mockUseBasicDataFromDetailsData = useBasicDataFromDetailsData as jest.Mock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { getTimelineEventData } from '../../../utils/get_timeline_event_data';
import { RiskSeverity } from '../../../../../../../common/search_strategy';
import { useRiskScore } from '../../../../../../explore/containers/risk_score';

jest.mock('../../../../../../risk_score/containers');
jest.mock('../../../../../../explore/containers/risk_score');
const mockUseRiskScore = useRiskScore as jest.Mock;

jest.mock('../../../../../containers/detection_engine/alerts/use_host_isolation_status', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { SummaryValueCell } from '../../../../../../common/components/event_deta
import { useRiskScore } from '../../../../../../explore/containers/risk_score';
import { RiskScoreEntity } from '../../../../../../../common/search_strategy';
import { getEmptyTagValue } from '../../../../../../common/components/empty_value';
import { RiskScore } from '../../../../../../explore/risk_score/components/severity/common';
import { RiskScore } from '../../../../../../explore/components/risk_score/severity/common';
import {
FirstLastSeen,
FirstLastSeenType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type { EuiFlexItemProps } from '@elastic/eui/src/components/flex/flex_ite
import { useRiskScore } from '../../../../../../explore/containers/risk_score';
import { RiskScoreEntity } from '../../../../../../../common/search_strategy';
import { getEmptyTagValue } from '../../../../../../common/components/empty_value';
import { RiskScore } from '../../../../../../explore/risk_score/components/severity/common';
import { RiskScore } from '../../../../../../explore/components/risk_score/severity/common';
import {
FirstLastSeen,
FirstLastSeenType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { RiskSeverity } from '../../../../../../../common/search_strategy';
import { useRiskScore } from '../../../../../../explore/containers/risk_score';
import { find } from 'lodash/fp';

jest.mock('../../../../../../risk_score/containers');
jest.mock('../../../../../../explore/containers/risk_score');
const mockUseRiskScore = useRiskScore as jest.Mock;

describe('AlertDetailsPage - SummaryTab - UserPanel', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { TestProviders } from '../../../common/mock';
import { useAuthentications } from '../../containers/authentications';
import { useQueryToggle } from '../../../common/containers/query_toggle';

jest.mock('../../containers/query_toggle', () => ({
jest.mock('../../../common/containers/query_toggle', () => ({
useQueryToggle: jest.fn().mockReturnValue({ toggleStatus: true, setToggleStatus: jest.fn() }),
}));
jest.mock('../../containers/authentications', () => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { AuthenticationsUserTable } from './authentications_user_table';
import { usersModel } from '../../users/store';
import { AuthStackByField } from '../../../../common/search_strategy';

jest.mock('../../containers/query_toggle', () => ({
jest.mock('../../../common/containers/query_toggle', () => ({
useQueryToggle: jest.fn().mockReturnValue({ toggleStatus: true, setToggleStatus: jest.fn() }),
}));
jest.mock('../../containers/authentications', () => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { ThemeProvider } from 'styled-components';
import { getMockTheme } from '../../../common/lib/kibana/kibana_react.mock';
import { Direction } from '../../../../common/search_strategy';
import { useQueryToggle } from '../../../common/containers/query_toggle';
jest.mock('../../containers/query_toggle');
jest.mock('../../../common/containers/query_toggle');

jest.mock('react', () => {
const r = jest.requireActual('react');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import { RiskScoreEntity } from '../../../../../common/search_strategy';
import { HostsType } from '../../../hosts/store/model';
import { UsersType } from '../../../users/store/model';

jest.mock('../../containers');
jest.mock('../../../common/containers/query_toggle');
jest.mock('../../../common/lib/kibana');
jest.mock('../../../containers/risk_score');
jest.mock('../../../../common/containers/query_toggle');
jest.mock('../../../../common/lib/kibana');
describe.each([RiskScoreEntity.host, RiskScoreEntity.user])(
'Risk Tab Body entityType: %s',
(riskEntity) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import * as i18n from './translations';

import { useQueryInspector } from '../../../../common/components/page/manage_query';
import { RiskScoreOverTime } from '../risk_score_over_time';
import { TopRiskScoreContributors } from '../../../../common/components/top_risk_score_contributors';
import { TopRiskScoreContributors } from '../top_risk_score_contributors';
import { useQueryToggle } from '../../../../common/containers/query_toggle';
import {
HostRiskScoreQueryId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { FormattedMessage } from '@kbn/i18n-react';
import { getRiskEntityTranslation } from '../translations';
import * as i18n from './translations';
import { useOnOpenCloseHandler } from '../../../../helper_hooks';
import { RiskScore } from '../../../risk_score/components/severity/common';
import { RiskScore } from '../severity/common';
import { RiskScoreEntity, RiskSeverity } from '../../../../../common/search_strategy';
import { RiskScoreDocLink } from '../risk_score_onboarding/risk_score_doc_link';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
uninstallRiskScoreModule,
} from './utils';

jest.mock('../../containers/onboarding/api');
jest.mock('../../../containers/risk_score/onboarding/api');

const mockHttp = {
post: jest.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@
import { render } from '@testing-library/react';
import React from 'react';
import { TopRiskScoreContributors } from '.';
import { TestProviders } from '../../mock';
import type { RuleRisk } from '../../../../common/search_strategy';

jest.mock('../../containers/query_toggle');
jest.mock('../../../risk_score/containers');
import { TestProviders } from '../../../../common/mock';
import type { RuleRisk } from '../../../../../common/search_strategy';

jest.mock('../../../../common/containers/query_toggle');
jest.mock('../../../containers/risk_score');
const testProps = {
riskScore: [],
setQuery: jest.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import React, { useMemo } from 'react';
import type { EuiTableFieldDataColumnType } from '@elastic/eui';
import { EuiFlexGroup, EuiFlexItem, EuiPanel, EuiInMemoryTable } from '@elastic/eui';

import { HeaderSection } from '../header_section';
import { InspectButton, InspectButtonContainer } from '../inspect';
import { HeaderSection } from '../../../../common/components/header_section';
import { InspectButton, InspectButtonContainer } from '../../../../common/components/inspect';
import * as i18n from './translations';

import type { RuleRisk } from '../../../../common/search_strategy';
import type { RuleRisk } from '../../../../../common/search_strategy';

import { RuleLink } from '../../../detection_engine/rule_management_ui/components/rules_table/use_columns';
import { RuleLink } from '../../../../detection_engine/rule_management_ui/components/rules_table/use_columns';

export interface TopRiskScoreContributorsProps {
loading: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import React from 'react';
import { TestProviders } from '../../../common/mock';
import type { LensAttributes } from '../../../common/components/visualization_actions/types';

jest.mock('../visualization_actions', () => {
jest.mock('../../../common/components/visualization_actions', () => {
return {
VisualizationActions: () => <div data-test-subj="visualizationActions" />,
HISTOGRAM_ACTIONS_BUTTON_CLASS: 'histogram-actions-trigger',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import React from 'react';
import { TestProviders } from '../../../common/mock';
import type { LensAttributes } from '../../../common/components/visualization_actions/types';

jest.mock('../visualization_actions', () => {
jest.mock('../../../common/components/visualization_actions', () => {
return {
VisualizationActions: () => <div data-test-subj="visualizationActions" />,
HISTOGRAM_ACTIONS_BUTTON_CLASS: 'histogram-actions-trigger',
};
});

jest.mock('../visualization_actions/lens_embeddable', () => {
jest.mock('../../../common/components/visualization_actions/lens_embeddable', () => {
return {
LensEmbeddable: () => <div data-test-subj="embeddable-metric" />,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ import type { LensAttributes } from '../../../common/components/visualization_ac
const from = '2019-06-15T06:00:00.000Z';
const to = '2019-06-18T06:00:00.000Z';

jest.mock('../charts/areachart', () => {
jest.mock('../../../common/components/charts/areachart', () => {
return { AreaChart: () => <div className="areachart" /> };
});

jest.mock('../charts/barchart', () => {
jest.mock('../../../common/components/charts/barchart', () => {
return { BarChart: () => <div className="barchart" /> };
});

jest.mock('../visualization_actions', () => {
jest.mock('../../../common/components/visualization_actions', () => {
return {
VisualizationActions: () => <div className="visualizationActions" />,
HISTOGRAM_ACTIONS_BUTTON_CLASS: 'histogram-actions-trigger',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { AuthStackByField } from '../../../../common/search_strategy';
import { TestProviders } from '../../../common/mock';
import { useSearchStrategy } from '../../../common/containers/use_search_strategy';

jest.mock('../use_search_strategy', () => ({
jest.mock('../../../common/containers/use_search_strategy', () => ({
useSearchStrategy: jest.fn(),
}));
const mockUseSearchStrategy = useSearchStrategy as jest.Mock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ import { useAppToastsMock } from '../../../../common/hooks/use_app_toasts.mock';
import { useRiskScoreFeatureStatus } from '../feature_status';
import { RiskScoreEntity } from '../../../../../common/search_strategy';

jest.mock('../../../common/containers/use_search_strategy', () => ({
jest.mock('../../../../common/containers/use_search_strategy', () => ({
useSearchStrategy: jest.fn(),
}));

jest.mock('../../../common/hooks/use_space_id', () => ({
jest.mock('../../../../common/hooks/use_space_id', () => ({
useSpaceId: jest.fn().mockReturnValue('default'),
}));

jest.mock('../../../common/hooks/use_app_toasts');
jest.mock('../../../../common/hooks/use_app_toasts');
jest.mock('../feature_status');

const mockUseRiskScoreFeatureStatus = useRiskScoreFeatureStatus as jest.Mock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { RiskScoreEntity } from '../../../../../common/search_strategy';
import { useFetch } from '../../../../common/hooks/use_fetch';
import { useMlCapabilities } from '../../../../common/components/ml/hooks/use_ml_capabilities';

jest.mock('../../../common/hooks/use_fetch');
jest.mock('../../../common/components/ml/hooks/use_ml_capabilities');
jest.mock('../../../../common/hooks/use_fetch');
jest.mock('../../../../common/components/ml/hooks/use_ml_capabilities');

const mockFetch = jest.fn();
const mockUseMlCapabilities = useMlCapabilities as jest.Mock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
import * as i18n from './translations';
import { isIndexNotFoundError } from '../../../../common/utils/exceptions';
import type { ESTermQuery } from '../../../../../common/typed_json';
import type { SeverityCount } from '../../../risk_score/components/severity/types';
import type { SeverityCount } from '../../../components/risk_score/severity/types';
import { useSpaceId } from '../../../../common/hooks/use_space_id';
import { useMlCapabilities } from '../../../../common/components/ml/hooks/use_ml_capabilities';
import { useSearchStrategy } from '../../../../common/containers/use_search_strategy';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import * as i18n from './translations';
import { HostsTableType } from '../../store/model';
import type { RiskSeverity } from '../../../../../common/search_strategy';
import { RiskScoreFields } from '../../../../../common/search_strategy';
import { RiskScore } from '../../../risk_score/components/severity/common';
import { RiskScore } from '../../../components/risk_score/severity/common';

export const getHostRiskScoreColumns = ({
dispatchSeverityUpdate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ import type { State } from '../../../../common/store';
import * as i18n from '../hosts_table/translations';
import * as i18nHosts from './translations';

import { SeverityBadges } from '../../../risk_score/components/severity/severity_badges';
import { SeverityBar } from '../../../risk_score/components/severity/severity_bar';
import { SeverityFilterGroup } from '../../../risk_score/components/severity/severity_filter_group';
import { SeverityBadges } from '../../../components/risk_score/severity/severity_badges';
import { SeverityBar } from '../../../components/risk_score/severity/severity_bar';
import { SeverityFilterGroup } from '../../../components/risk_score/severity/severity_filter_group';

import type { SeverityCount } from '../../../risk_score/components/severity/types';
import type { SeverityCount } from '../../../components/risk_score/severity/types';

export const rowItems: ItemsPerRow[] = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import type { HostsTableColumns } from '.';
import * as i18n from './translations';
import type { Maybe, RiskSeverity } from '../../../../../common/search_strategy';
import { VIEW_HOSTS_BY_SEVERITY } from '../host_risk_score_table/translations';
import { RiskScore } from '../../../risk_score/components/severity/common';
import { RiskScore } from '../../../components/risk_score/severity/common';

export const getHostsColumns = (
showRiskColumn: boolean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,28 @@ import { HostsTable } from '.';
import { mockData } from './mock';
import { render } from '@testing-library/react';

jest.mock('../../../common/lib/kibana');
jest.mock('../../../../common/lib/kibana');

jest.mock('../../../common/lib/kibana/hooks', () => ({
jest.mock('../../../../common/lib/kibana/hooks', () => ({
useNavigateTo: () => ({
navigateTo: jest.fn(),
}),
}));

// Test will fail because we will to need to mock some core services to make the test work
// For now let's forget about SiemSearchBar and QueryBar
jest.mock('../../../common/components/search_bar', () => ({
jest.mock('../../../../common/components/search_bar', () => ({
SiemSearchBar: () => null,
}));
jest.mock('../../../common/components/query_bar', () => ({
jest.mock('../../../../common/components/query_bar', () => ({
QueryBar: () => null,
}));

jest.mock('../../../common/components/link_to');
jest.mock('../../../../common/components/link_to');

const mockUseMlCapabilities = jest.fn();

jest.mock('../../../common/components/ml/hooks/use_ml_capabilities', () => ({
jest.mock('../../../../common/components/ml/hooks/use_ml_capabilities', () => ({
useMlCapabilities: () => mockUseMlCapabilities(),
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ import { useIsExperimentalFeatureEnabled } from '../../../../../common/hooks/use
import { useRefetchByRestartingSession } from '../../../../../common/components/page/use_refetch_by_session';
import { KpiBaseComponentManage } from '../common';

jest.mock('../../../../common/containers/query_toggle');
jest.mock('../../../../../common/containers/query_toggle');
jest.mock('../../../containers/kpi_hosts/hosts');
jest.mock('../common', () => ({
KpiBaseComponentManage: jest
.fn()
.mockReturnValue(<span data-test-subj="KpiBaseComponentManage" />),
}));
jest.mock('../../../../common/hooks/use_experimental_features', () => ({
jest.mock('../../../../../common/hooks/use_experimental_features', () => ({
useIsExperimentalFeatureEnabled: jest.fn(),
}));
jest.mock('../../../../common/components/page/use_refetch_by_session', () => ({
jest.mock('../../../../../common/components/page/use_refetch_by_session', () => ({
useRefetchByRestartingSession: jest.fn(),
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import { useErrorToast } from '../../../../../common/hooks/use_error_toast';
import { HoverVisibilityContainer } from '../../../../../common/components/hover_visibility_container';
import type { KpiRiskScoreStrategyResponse } from '../../../../../../common/search_strategy';
import { RiskScoreEntity, RiskSeverity } from '../../../../../../common/search_strategy';
import { RiskScore } from '../../../../risk_score/components/severity/common';
import { RiskScore } from '../../../../components/risk_score/severity/common';

const KpiBaseComponentLoader: React.FC = () => (
<EuiFlexGroup justifyContent="center" alignItems="center" data-test-subj="KpiLoader">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ import { useIsExperimentalFeatureEnabled } from '../../../../../common/hooks/use
import { useRefetchByRestartingSession } from '../../../../../common/components/page/use_refetch_by_session';
import { KpiBaseComponentManage } from '../common';

jest.mock('../../../../common/containers/query_toggle');
jest.mock('../../../../../common/containers/query_toggle');
jest.mock('../../../containers/kpi_hosts/unique_ips');
jest.mock('../common', () => ({
KpiBaseComponentManage: jest
.fn()
.mockReturnValue(<span data-test-subj="KpiBaseComponentManage" />),
}));
jest.mock('../../../../common/hooks/use_experimental_features', () => ({
jest.mock('../../../../../common/hooks/use_experimental_features', () => ({
useIsExperimentalFeatureEnabled: jest.fn(),
}));
jest.mock('../../../../common/components/page/use_refetch_by_session', () => ({
jest.mock('../../../../../common/components/page/use_refetch_by_session', () => ({
useRefetchByRestartingSession: jest.fn(),
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { mockData } from './mock';
import { HostsType } from '../../store/model';
import * as i18n from './translations';

jest.mock('../../../common/lib/kibana');
jest.mock('../../../../common/lib/kibana');

jest.mock('@elastic/eui', () => {
const original = jest.requireActual('@elastic/eui');
Expand All @@ -30,7 +30,7 @@ jest.mock('@elastic/eui', () => {
};
});

jest.mock('../../../common/components/link_to');
jest.mock('../../../../common/components/link_to');

describe('Uncommon Process Table Component', () => {
const loadPage = jest.fn();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { TestProviders } from '../../../../../common/mock';
import { ID, useHostDetails } from '.';
import { useSearchStrategy } from '../../../../../common/containers/use_search_strategy';

jest.mock('../../../../common/containers/use_search_strategy', () => ({
jest.mock('../../../../../common/containers/use_search_strategy', () => ({
useSearchStrategy: jest.fn(),
}));
const mockUseSearchStrategy = useSearchStrategy as jest.Mock;
Expand Down
Loading

0 comments on commit 29f66c1

Please sign in to comment.