Skip to content

Commit

Permalink
fix tests and types
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelolo24 committed Sep 9, 2021
1 parent 577376a commit 756470a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

import { ALERT_RULE_UUID } from '@kbn/rule-data-utils';
import _ from 'lodash';
import {
ALERT_ORIGINAL_EVENT_KIND,
ALERT_ORIGINAL_EVENT_MODULE,
} from '../../../../timelines/common';
import { Ecs } from '../../../common/ecs';
import { generateMockDetailItemData } from '../mock';
import { isAlertFromEndpointAlert, isAlertFromEndpointEvent } from './endpoint_alert_check';
Expand Down Expand Up @@ -58,8 +62,8 @@ describe('isAlertFromEndpointAlert', () => {
it('should return true if detections data comes from an endpoint rule', () => {
const mockEcsData = {
_id: 'mockId',
'signal.original_event.module': ['endpoint'],
'signal.original_event.kind': ['alert'],
[ALERT_ORIGINAL_EVENT_MODULE]: ['endpoint'],
[ALERT_ORIGINAL_EVENT_KIND]: ['alert'],
} as Ecs;
expect(isAlertFromEndpointAlert({ ecsData: mockEcsData })).toBe(true);
});
Expand All @@ -71,15 +75,15 @@ describe('isAlertFromEndpointAlert', () => {
it('should return false if it is not an Alert', () => {
const mockEcsData = {
_id: 'mockId',
'signal.original_event.module': ['endpoint'],
[ALERT_ORIGINAL_EVENT_MODULE]: ['endpoint'],
} as Ecs;
expect(isAlertFromEndpointAlert({ ecsData: mockEcsData })).toBeFalsy();
});

it('should return false if it is not an endpoint module', () => {
const mockEcsData = {
_id: 'mockId',
'signal.original_event.kind': ['alert'],
[ALERT_ORIGINAL_EVENT_KIND]: ['alert'],
} as Ecs;
expect(isAlertFromEndpointAlert({ ecsData: mockEcsData })).toBeFalsy();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
EuiHorizontalRule,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { ALERT_REASON, ALERT_RULE_NAME, ALERT_RULE_UUID, TIMESTAMP } from '@kbn/rule-data-utils';
import { ALERT_REASON, ALERT_RULE_NAME, ALERT_RULE_UUID } from '@kbn/rule-data-utils';
import { get } from 'lodash';
import moment from 'moment';
import React, { ComponentType, useCallback, useMemo } from 'react';
Expand Down

0 comments on commit 756470a

Please sign in to comment.