@@ -371,6 +371,65 @@ describe.each([{ permission: 'Master' }, { permission: 'Admin' }])(
371371 expect ( tasksUids [ 0 ] ) . toEqual ( addDocumentsTask . taskUid )
372372 } )
373373
374+ // filters error code: INVALID_TASK_TYPES_FILTER
375+ test ( `${ permission } key: Try to filter on task types with wrong type` , async ( ) => {
376+ const client = await getClient ( permission )
377+
378+ await expect (
379+ // @ts -expect-error testing wrong argument type
380+ client . getTasks ( { types : [ 'wrong' ] } )
381+ ) . rejects . toHaveProperty (
382+ 'code' ,
383+ ErrorStatusCode . INVALID_TASK_TYPES_FILTER
384+ )
385+ } )
386+
387+ // filters error code: INVALID_TASK_STATUSES_FILTER
388+ test ( `${ permission } key: Try to filter on statuses with wrong type` , async ( ) => {
389+ const client = await getClient ( permission )
390+
391+ await expect (
392+ // @ts -expect-error testing wrong argument type
393+ client . getTasks ( { statuses : [ 'wrong' ] } )
394+ ) . rejects . toHaveProperty (
395+ 'code' ,
396+ ErrorStatusCode . INVALID_TASK_STATUSES_FILTER
397+ )
398+ } )
399+
400+ // filters error code: INVALID_TASK_UIDS_FILTER
401+ test ( `${ permission } key: Try to filter on uids with wrong type` , async ( ) => {
402+ const client = await getClient ( permission )
403+
404+ await expect (
405+ // @ts -expect-error testing wrong argument type
406+ client . getTasks ( { uids : [ 'wrong' ] } )
407+ ) . rejects . toHaveProperty ( 'code' , ErrorStatusCode . INVALID_TASK_UIDS_FILTER )
408+ } )
409+
410+ // filters error code: INVALID_TASK_CANCELED_BY_FILTER
411+ test ( `${ permission } key: Try to filter on canceledBy filter with wrong type` , async ( ) => {
412+ const client = await getClient ( permission )
413+
414+ await expect (
415+ // @ts -expect-error testing wrong canceledBy type
416+ client . getTasks ( { canceledBy : [ 'wrong' ] } )
417+ ) . rejects . toHaveProperty (
418+ 'code' ,
419+ ErrorStatusCode . INVALID_TASK_CANCELED_BY_FILTER
420+ )
421+ } )
422+
423+ // filters error code: INVALID_TASK_DATE_FILTER
424+ test ( `${ permission } key: Try to filter on dates with invalid date format` , async ( ) => {
425+ const client = await getClient ( permission )
426+
427+ await expect (
428+ // @ts -expect-error testing wrong date format
429+ client . getTasks ( { beforeEnqueuedAt : 'wrong' } )
430+ ) . rejects . toHaveProperty ( 'code' , ErrorStatusCode . INVALID_TASK_DATE_FILTER )
431+ } )
432+
374433 // cancel: uid
375434 test ( `${ permission } key: Cancel a task using the uid filter` , async ( ) => {
376435 const client = await getClient ( permission )
@@ -525,6 +584,16 @@ describe.each([{ permission: 'Master' }, { permission: 'Admin' }])(
525584 expect ( task . details ?. originalFilters ) . toContain ( 'afterFinishedAt' )
526585 } )
527586
587+ // cancel error code: MISSING_TASK_FILTER
588+ test ( `${ permission } key: Try to cancel without filters and fail` , async ( ) => {
589+ const client = await getClient ( permission )
590+
591+ await expect (
592+ // @ts -expect-error testing wrong argument type
593+ client . cancelTasks ( )
594+ ) . rejects . toHaveProperty ( 'code' , ErrorStatusCode . MISSING_TASK_FILTERS )
595+ } )
596+
528597 // delete: uid
529598 test ( `${ permission } key: Delete a task using the uid filter` , async ( ) => {
530599 const client = await getClient ( permission )
0 commit comments