From 41d0cd2d44c8bdba5b75f02d49a88b13d6e06db6 Mon Sep 17 00:00:00 2001 From: Eugene Molodkin Date: Thu, 7 Nov 2024 13:28:28 +0100 Subject: [PATCH] wip: delete response --- .../evaluation/test-definitions.controller.ee.ts | 4 +++- .../evaluation/test-definitions.api.test.ts | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/evaluation/test-definitions.controller.ee.ts b/packages/cli/src/evaluation/test-definitions.controller.ee.ts index bf3136229c..8e754497ec 100644 --- a/packages/cli/src/evaluation/test-definitions.controller.ee.ts +++ b/packages/cli/src/evaluation/test-definitions.controller.ee.ts @@ -59,7 +59,9 @@ export class TestDefinitionsController { if (workflowIds.length === 0) throw new NotFoundError('Test not found'); - return await this.testsService.delete(Number(req.params.id), workflowIds); + await this.testsService.delete(Number(req.params.id), workflowIds); + + return { success: true }; } @Patch('/:id') diff --git a/packages/cli/test/integration/evaluation/test-definitions.api.test.ts b/packages/cli/test/integration/evaluation/test-definitions.api.test.ts index c5fc24dc61..205a6c4834 100644 --- a/packages/cli/test/integration/evaluation/test-definitions.api.test.ts +++ b/packages/cli/test/integration/evaluation/test-definitions.api.test.ts @@ -279,3 +279,18 @@ describe('PATCH /evaluation/test-definitions/:id', () => { expect(resp.body.message).toBe('Annotation tag not found'); }); }); + +describe('DELETE /evaluation/test-definitions/:id', () => { + test('should delete test definition', async () => { + const newTest = Container.get(TestDefinitionRepository).create({ + name: 'test', + workflow: { id: workflowUnderTest.id }, + }); + await Container.get(TestDefinitionRepository).save(newTest); + + const resp = await authOwnerAgent.delete(`/evaluation/test-definitions/${newTest.id}`); + + expect(resp.statusCode).toBe(200); + expect(resp.body.data.success).toBe(true); + }); +});