Fix 404 error on deleted rule alert view (#103491)
This commit is contained in:
parent
60d1ef9f92
commit
706298d2bb
2 changed files with 7 additions and 7 deletions
|
@ -11,7 +11,7 @@ import { waitFor } from '@testing-library/react';
|
|||
import { AlertSummaryView } from './alert_summary_view';
|
||||
import { mockAlertDetailsData } from './__mocks__';
|
||||
import { TimelineEventsDetailsItem } from '../../../../common/search_strategy';
|
||||
import { useRuleAsync } from '../../../detections/containers/detection_engine/rules/use_rule_async';
|
||||
import { useRuleWithFallback } from '../../../detections/containers/detection_engine/rules/use_rule_with_fallback';
|
||||
|
||||
import { TestProviders } from '../../mock';
|
||||
import { mockBrowserFields } from '../../containers/source/mock';
|
||||
|
@ -19,9 +19,9 @@ import { useMountAppended } from '../../utils/use_mount_appended';
|
|||
|
||||
jest.mock('../../lib/kibana');
|
||||
|
||||
jest.mock('../../../detections/containers/detection_engine/rules/use_rule_async', () => {
|
||||
jest.mock('../../../detections/containers/detection_engine/rules/use_rule_with_fallback', () => {
|
||||
return {
|
||||
useRuleAsync: jest.fn(),
|
||||
useRuleWithFallback: jest.fn(),
|
||||
};
|
||||
});
|
||||
|
||||
|
@ -37,7 +37,7 @@ describe('AlertSummaryView', () => {
|
|||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
(useRuleAsync as jest.Mock).mockReturnValue({
|
||||
(useRuleWithFallback as jest.Mock).mockReturnValue({
|
||||
rule: {
|
||||
note: 'investigation guide',
|
||||
},
|
||||
|
@ -64,7 +64,7 @@ describe('AlertSummaryView', () => {
|
|||
});
|
||||
|
||||
test("render no investigation guide if it doesn't exist", async () => {
|
||||
(useRuleAsync as jest.Mock).mockReturnValue({
|
||||
(useRuleWithFallback as jest.Mock).mockReturnValue({
|
||||
rule: {
|
||||
note: null,
|
||||
},
|
||||
|
|
|
@ -35,7 +35,7 @@ import {
|
|||
import { DESTINATION_IP_FIELD_NAME, SOURCE_IP_FIELD_NAME } from '../../../network/components/ip';
|
||||
import { SummaryView } from './summary_view';
|
||||
import { AlertSummaryRow, getSummaryColumns, SummaryRow } from './helpers';
|
||||
import { useRuleAsync } from '../../../detections/containers/detection_engine/rules/use_rule_async';
|
||||
import { useRuleWithFallback } from '../../../detections/containers/detection_engine/rules/use_rule_with_fallback';
|
||||
import { LineClamp } from '../line_clamp';
|
||||
import { endpointAlertCheck } from '../../utils/endpoint_alert_check';
|
||||
|
||||
|
@ -207,7 +207,7 @@ const AlertSummaryViewComponent: React.FC<{
|
|||
? item?.originalValue[0]
|
||||
: item?.originalValue ?? null;
|
||||
}, [data]);
|
||||
const { rule: maybeRule } = useRuleAsync(ruleId);
|
||||
const { rule: maybeRule } = useRuleWithFallback(ruleId);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
Loading…
Reference in a new issue