-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
## [SIEM] Additional Endgame Row Renderer Code Coverage Adds additional unit test coverage for the [Endgame row renderers](#48277) ### Endgame Event Types / Subtypes Additional unit tests were added for the following Endgame event types / subtypes: * DNS (`dns_event`) - [X] `request_event` * File (FIM) (`file_event`) - [X] `file_create_event` - [X] `file_delete_event` * Network (`network_event`) - [X] `ipv4_connection_accept_event` - [X] `ipv6_connection_accept_event` - [X] `ipv4_disconnect_received_event` - [X] `ipv6_disconnect_received_event` * Security (Authentication) (`security_event`) - [X] `user_logon` - [X] `admin_logon` - [X] `explicit_user_logon` - [X] `user_logoff` * Process (`process_event`) - [X] `creation_event` - [X] `termination_event` ### Non-Endgame Events Additional unit tests for some non-Endgame events were also added, including: * FIM file `created` events * FIM file `deleted` events * Socket `socket_opened` events * Socket `socket_closed` events elastic/ecs-dev#178
- Loading branch information
1 parent
caa7bcb
commit 113bc2e
Showing
17 changed files
with
2,414 additions
and
58 deletions.
There are no files selected for viewing
87 changes: 87 additions & 0 deletions
87
...egacy/plugins/siem/public/components/timeline/body/renderers/exit_code_draggable.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import * as React from 'react'; | ||
import { mountWithIntl } from 'test_utils/enzyme_helpers'; | ||
|
||
import { TestProviders } from '../../../../mock'; | ||
|
||
import { ExitCodeDraggable } from './exit_code_draggable'; | ||
|
||
describe('ExitCodeDraggable', () => { | ||
test('it renders the expected text and exit code, when both text and an endgameExitCode are provided', () => { | ||
const wrapper = mountWithIntl( | ||
<TestProviders> | ||
<ExitCodeDraggable contextId="test" endgameExitCode="0" eventId="1" text="with exit code" /> | ||
</TestProviders> | ||
); | ||
expect(wrapper.text()).toEqual('with exit code0'); | ||
}); | ||
|
||
test('it returns an empty string when text is provided, but endgameExitCode is undefined', () => { | ||
const wrapper = mountWithIntl( | ||
<TestProviders> | ||
<ExitCodeDraggable | ||
contextId="test" | ||
endgameExitCode={undefined} | ||
eventId="1" | ||
text="with exit code" | ||
/> | ||
</TestProviders> | ||
); | ||
expect(wrapper.text()).toEqual(''); | ||
}); | ||
|
||
test('it returns an empty string when text is provided, but endgameExitCode is null', () => { | ||
const wrapper = mountWithIntl( | ||
<TestProviders> | ||
<ExitCodeDraggable | ||
contextId="test" | ||
endgameExitCode={null} | ||
eventId="1" | ||
text="with exit code" | ||
/> | ||
</TestProviders> | ||
); | ||
expect(wrapper.text()).toEqual(''); | ||
}); | ||
|
||
test('it returns an empty string when text is provided, but endgameExitCode is an empty string', () => { | ||
const wrapper = mountWithIntl( | ||
<TestProviders> | ||
<ExitCodeDraggable contextId="test" endgameExitCode="" eventId="1" text="with exit code" /> | ||
</TestProviders> | ||
); | ||
expect(wrapper.text()).toEqual(''); | ||
}); | ||
|
||
test('it renders just the exit code when text is undefined', () => { | ||
const wrapper = mountWithIntl( | ||
<TestProviders> | ||
<ExitCodeDraggable contextId="test" endgameExitCode="1" eventId="1" text={undefined} /> | ||
</TestProviders> | ||
); | ||
expect(wrapper.text()).toEqual('1'); | ||
}); | ||
|
||
test('it renders just the exit code when text is null', () => { | ||
const wrapper = mountWithIntl( | ||
<TestProviders> | ||
<ExitCodeDraggable contextId="test" endgameExitCode="1" eventId="1" text={null} /> | ||
</TestProviders> | ||
); | ||
expect(wrapper.text()).toEqual('1'); | ||
}); | ||
|
||
test('it renders just the exit code when text is an empty string', () => { | ||
const wrapper = mountWithIntl( | ||
<TestProviders> | ||
<ExitCodeDraggable contextId="test" endgameExitCode="1" eventId="1" text="" /> | ||
</TestProviders> | ||
); | ||
expect(wrapper.text()).toEqual('1'); | ||
}); | ||
}); |
110 changes: 110 additions & 0 deletions
110
x-pack/legacy/plugins/siem/public/components/timeline/body/renderers/file_draggable.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import * as React from 'react'; | ||
import { mountWithIntl } from 'test_utils/enzyme_helpers'; | ||
|
||
import { TestProviders } from '../../../../mock'; | ||
|
||
import { FileDraggable } from './file_draggable'; | ||
|
||
describe('FileDraggable', () => { | ||
test('it prefers fileName and filePath over endgameFileName and endgameFilePath when all of them are provided', () => { | ||
const wrapper = mountWithIntl( | ||
<TestProviders> | ||
<FileDraggable | ||
contextId="test" | ||
endgameFileName="[endgameFileName]" | ||
endgameFilePath="[endgameFilePath]" | ||
eventId="1" | ||
fileName="[fileName]" | ||
filePath="[filePath]" | ||
></FileDraggable> | ||
</TestProviders> | ||
); | ||
expect(wrapper.text()).toEqual('[fileName]in[filePath]'); | ||
}); | ||
|
||
test('it returns an empty string when none of the files or paths are provided', () => { | ||
const wrapper = mountWithIntl( | ||
<TestProviders> | ||
<FileDraggable | ||
contextId="test" | ||
endgameFileName={undefined} | ||
endgameFilePath={undefined} | ||
eventId="1" | ||
fileName={undefined} | ||
filePath={undefined} | ||
></FileDraggable> | ||
</TestProviders> | ||
); | ||
expect(wrapper.text()).toEqual(''); | ||
}); | ||
|
||
test('it renders just the endgameFileName if only endgameFileName is provided', () => { | ||
const wrapper = mountWithIntl( | ||
<TestProviders> | ||
<FileDraggable | ||
contextId="test" | ||
endgameFileName="[endgameFileName]" | ||
endgameFilePath={undefined} | ||
eventId="1" | ||
fileName={undefined} | ||
filePath={undefined} | ||
/> | ||
</TestProviders> | ||
); | ||
expect(wrapper.text()).toEqual('[endgameFileName]'); | ||
}); | ||
|
||
test('it renders "in endgameFilePath" if only endgameFilePath is provided', () => { | ||
const wrapper = mountWithIntl( | ||
<TestProviders> | ||
<FileDraggable | ||
contextId="test" | ||
endgameFileName={undefined} | ||
endgameFilePath="[endgameFilePath]" | ||
eventId="1" | ||
fileName={undefined} | ||
filePath={undefined} | ||
/> | ||
</TestProviders> | ||
); | ||
expect(wrapper.text()).toEqual('in[endgameFilePath]'); | ||
}); | ||
|
||
test('it renders just the filename if only fileName is provided', () => { | ||
const wrapper = mountWithIntl( | ||
<TestProviders> | ||
<FileDraggable | ||
contextId="test" | ||
endgameFileName={undefined} | ||
endgameFilePath={undefined} | ||
eventId="1" | ||
fileName="[fileName]" | ||
filePath={undefined} | ||
/> | ||
</TestProviders> | ||
); | ||
expect(wrapper.text()).toEqual('[fileName]'); | ||
}); | ||
|
||
test('it renders "in filePath" if only filePath is provided', () => { | ||
const wrapper = mountWithIntl( | ||
<TestProviders> | ||
<FileDraggable | ||
contextId="test" | ||
endgameFileName={undefined} | ||
endgameFilePath={undefined} | ||
eventId="1" | ||
fileName={undefined} | ||
filePath="[filePath]" | ||
/> | ||
</TestProviders> | ||
); | ||
expect(wrapper.text()).toEqual('in[filePath]'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.