Skip to content

Commit e5db448

Browse files
committed
Changed useActionHistoryUrlParams() test to include all response actions
1 parent 0b47bc3 commit e5db448

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

x-pack/plugins/security_solution/common/endpoint/service/response_actions/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export const CONSOLE_RESPONSE_ACTION_COMMANDS = [
4343
'kill-process',
4444
'suspend-process',
4545
'processes',
46+
'get-file',
4647
] as const;
4748

4849
export type ConsoleResponseActionCommands = typeof CONSOLE_RESPONSE_ACTION_COMMANDS[number];

x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/components/use_action_history_url_params.test.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,18 @@
55
* 2.0.
66
*/
77
import { actionsLogFiltersFromUrlParams } from './use_action_history_url_params';
8+
import type { ConsoleResponseActionCommands } from '../../../../../common/endpoint/service/response_actions/constants';
9+
import { CONSOLE_RESPONSE_ACTION_COMMANDS } from '../../../../../common/endpoint/service/response_actions/constants';
810

911
describe('#actionsLogFiltersFromUrlParams', () => {
12+
const getConsoleCommandsAsString = (): string => {
13+
return [...CONSOLE_RESPONSE_ACTION_COMMANDS].sort().join(',');
14+
};
15+
16+
const getConsoleCommandsAsArray = (): ConsoleResponseActionCommands[] => {
17+
return [...CONSOLE_RESPONSE_ACTION_COMMANDS].sort();
18+
};
19+
1020
it('should not use invalid command values from URL params', () => {
1121
expect(actionsLogFiltersFromUrlParams({ commands: 'asa,was' })).toEqual({
1222
commands: undefined,
@@ -21,10 +31,10 @@ describe('#actionsLogFiltersFromUrlParams', () => {
2131
it('should use valid command values from URL params', () => {
2232
expect(
2333
actionsLogFiltersFromUrlParams({
24-
commands: 'kill-process,isolate,processes,release,suspend-process',
34+
commands: getConsoleCommandsAsString(),
2535
})
2636
).toEqual({
27-
commands: ['isolate', 'kill-process', 'processes', 'release', 'suspend-process'],
37+
commands: getConsoleCommandsAsArray(),
2838
endDate: undefined,
2939
hosts: undefined,
3040
startDate: undefined,
@@ -62,15 +72,15 @@ describe('#actionsLogFiltersFromUrlParams', () => {
6272
it('should use valid command and status along with given host, user and date values from URL params', () => {
6373
expect(
6474
actionsLogFiltersFromUrlParams({
65-
commands: 'release,kill-process,isolate,processes,suspend-process',
75+
commands: getConsoleCommandsAsString(),
6676
statuses: 'successful,pending,failed',
6777
hosts: 'host-1,host-2',
6878
users: 'user-1,user-2',
6979
startDate: '2022-09-12T08:00:00.000Z',
7080
endDate: '2022-09-12T08:30:33.140Z',
7181
})
7282
).toEqual({
73-
commands: ['isolate', 'kill-process', 'processes', 'release', 'suspend-process'],
83+
commands: getConsoleCommandsAsArray(),
7484
endDate: '2022-09-12T08:30:33.140Z',
7585
hosts: ['host-1', 'host-2'],
7686
startDate: '2022-09-12T08:00:00.000Z',

0 commit comments

Comments
 (0)