55 * 2.0.
66 */
77import { 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
911describe ( '#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