diff --git a/packages/cli/src/PublicApi/v1/handlers/executions/executions.service.ts b/packages/cli/src/PublicApi/v1/handlers/executions/executions.service.ts index ee5afd0eb6ae45..5cfe11de682a2e 100644 --- a/packages/cli/src/PublicApi/v1/handlers/executions/executions.service.ts +++ b/packages/cli/src/PublicApi/v1/handlers/executions/executions.service.ts @@ -8,6 +8,7 @@ import Container from 'typedi'; import { ExecutionRepository } from '@/databases/repositories'; function getStatusCondition(status: ExecutionStatus | ExecutionStatus[]) { + const condition: Pick, 'status'> = {}; if (typeof status === 'string') { status = [status]; } @@ -22,7 +23,8 @@ function getStatusCondition(status: ExecutionStatus | ExecutionStatus[]) { output.add(currFilter); } } - return In(Array.from(output)); + condition.status = In(Array.from(output)); + return condition; } export async function getExecutions(params: { diff --git a/packages/cli/test/integration/publicApi/executions.test.ts b/packages/cli/test/integration/publicApi/executions.test.ts index 8f77cf5f6c8a4d..e2ce7e88a42c3d 100644 --- a/packages/cli/test/integration/publicApi/executions.test.ts +++ b/packages/cli/test/integration/publicApi/executions.test.ts @@ -301,9 +301,13 @@ describe('GET /executions', () => { }); expect(response.statusCode).toBe(200); - expect(response.body.data.length).toBe(1); expect(response.body.nextCursor).toBe(null); - + if (filterStatus === 'error') { + // Check for breaking change + expect(response.body.data.length).toBe(3); + } else { + expect(response.body.data.length).toBe(1); + } const { id, finished, @@ -362,8 +366,12 @@ describe('GET /executions', () => { }); expect(response.statusCode).toBe(200); - expect(response.body.data.length).toBe(filterStatusList.length); - + if (filterStatusList.includes('error')) { + // Check for breaking change + expect(response.body.data.length).toBe(filterStatusList.length + 2); + } else { + expect(response.body.data.length).toBe(filterStatusList.length); + } for (let execution of response.body.data) { const { id,