Skip to content

Commit 2cb2c57

Browse files
fix(public api): fix tests
1 parent f2a1391 commit 2cb2c57

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

packages/cli/src/PublicApi/v1/handlers/executions/executions.service.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import Container from 'typedi';
88
import { ExecutionRepository } from '@/databases/repositories';
99

1010
function getStatusCondition(status: ExecutionStatus | ExecutionStatus[]) {
11+
const condition: Pick<FindOptionsWhere<IExecutionFlattedDb>, 'status'> = {};
1112
if (typeof status === 'string') {
1213
status = [status];
1314
}
@@ -22,7 +23,8 @@ function getStatusCondition(status: ExecutionStatus | ExecutionStatus[]) {
2223
output.add(currFilter);
2324
}
2425
}
25-
return In(Array.from(output));
26+
condition.status = In(Array.from(output));
27+
return condition;
2628
}
2729

2830
export async function getExecutions(params: {

packages/cli/test/integration/publicApi/executions.test.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,13 @@ describe('GET /executions', () => {
301301
});
302302

303303
expect(response.statusCode).toBe(200);
304-
expect(response.body.data.length).toBe(1);
305304
expect(response.body.nextCursor).toBe(null);
306-
305+
if (filterStatus === 'error') {
306+
// Check for breaking change
307+
expect(response.body.data.length).toBe(3);
308+
} else {
309+
expect(response.body.data.length).toBe(1);
310+
}
307311
const {
308312
id,
309313
finished,
@@ -362,8 +366,12 @@ describe('GET /executions', () => {
362366
});
363367

364368
expect(response.statusCode).toBe(200);
365-
expect(response.body.data.length).toBe(filterStatusList.length);
366-
369+
if (filterStatusList.includes('error')) {
370+
// Check for breaking change
371+
expect(response.body.data.length).toBe(filterStatusList.length + 2);
372+
} else {
373+
expect(response.body.data.length).toBe(filterStatusList.length);
374+
}
367375
for (let execution of response.body.data) {
368376
const {
369377
id,

0 commit comments

Comments
 (0)