Skip to content

Commit

Permalink
fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelolo24 committed Aug 10, 2021
1 parent 8be779c commit 5379c2b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import {
ALERT_OWNER,
ALERT_REASON,
ALERT_RULE_NAMESPACE,
ALERT_STATUS,
ALERT_WORKFLOW_STATUS,
Expand Down Expand Up @@ -50,8 +51,9 @@ describe('buildAlert', () => {
const doc = sampleDocNoSortIdWithTimestamp('d5e8eb51-a6a0-456d-8a15-4b79bfec3d71');
delete doc._source.event;
const rule = getRulesSchemaMock();
const reason = 'alert reasonable reason';
const alert = {
...buildAlert([doc], rule, SPACE_ID),
...buildAlert([doc], rule, SPACE_ID, reason),
...additionalAlertFields(doc),
};
const timestamp = alert['@timestamp'];
Expand All @@ -68,6 +70,7 @@ describe('buildAlert', () => {
},
],
[ALERT_ORIGINAL_TIME]: '2020-04-20T21:27:45.000Z',
[ALERT_REASON]: 'alert reasonable reason',
[ALERT_STATUS]: 'open',
[ALERT_WORKFLOW_STATUS]: 'open',
...flattenWithPrefix(ALERT_RULE_NAMESPACE, {
Expand Down Expand Up @@ -119,8 +122,9 @@ describe('buildAlert', () => {
module: 'system',
};
const rule = getRulesSchemaMock();
const reason = 'alert reasonable reason';
const alert = {
...buildAlert([doc], rule, SPACE_ID),
...buildAlert([doc], rule, SPACE_ID, reason),
...additionalAlertFields(doc),
};
const timestamp = alert['@timestamp'];
Expand All @@ -143,6 +147,7 @@ describe('buildAlert', () => {
kind: 'event',
module: 'system',
},
[ALERT_REASON]: 'alert reasonable reason',
[ALERT_STATUS]: 'open',
[ALERT_WORKFLOW_STATUS]: 'open',
...flattenWithPrefix(ALERT_RULE_NAMESPACE, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,6 @@ export const buildSignalFromSequence = (
alertRiskScore: ruleSO.attributes.params.riskScore,
alertSeverity: ruleSO.attributes.params.severity,
timestamp,
userName: null,
hostName: null,
});
const signal: Signal = buildSignal(events, rule, reason);
const mergedEvents = objectArrayIntersection(events.map((event) => event._source));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ describe('buildSignal', () => {
const doc = sampleDocNoSortId('d5e8eb51-a6a0-456d-8a15-4b79bfec3d71');
delete doc._source.event;
const rule = getRulesSchemaMock();
const reason = 'signal reasonable reason';

const signal = {
...buildSignal([doc], rule),
...buildSignal([doc], rule, reason),
...additionalSignalFields(doc),
};
const expected: Signal = {
Expand Down Expand Up @@ -62,6 +64,7 @@ describe('buildSignal', () => {
},
],
original_time: '2020-04-20T21:27:45.000Z',
reason: 'signal reasonable reason',
status: 'open',
rule: {
author: [],
Expand Down Expand Up @@ -112,8 +115,9 @@ describe('buildSignal', () => {
module: 'system',
};
const rule = getRulesSchemaMock();
const reason = 'signal reasonable reason';
const signal = {
...buildSignal([doc], rule),
...buildSignal([doc], rule, reason),
...additionalSignalFields(doc),
};
const expected: Signal = {
Expand Down Expand Up @@ -143,6 +147,7 @@ describe('buildSignal', () => {
},
],
original_time: '2020-04-20T21:27:45.000Z',
reason: 'signal reasonable reason',
original_event: {
action: 'socket_opened',
dataset: 'socket',
Expand Down

0 comments on commit 5379c2b

Please sign in to comment.