From 3a4fd24d190d30358e1c37d7e17b720491395eda Mon Sep 17 00:00:00 2001 From: Eugene Molodkin Date: Mon, 11 Nov 2024 16:15:03 +0100 Subject: [PATCH] wip: fix lint issue, more tests --- .../src/evaluation/test-definition.service.ee.ts | 2 +- .../evaluation/test-definitions.api.test.ts | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/evaluation/test-definition.service.ee.ts b/packages/cli/src/evaluation/test-definition.service.ee.ts index f05f157b09..6431568363 100644 --- a/packages/cli/src/evaluation/test-definition.service.ee.ts +++ b/packages/cli/src/evaluation/test-definition.service.ee.ts @@ -83,7 +83,7 @@ export class TestDefinitionService { return await this.testDefinitionRepository.save(test); } - async update(id: number, attrs: TestDefinitionLike, accessibleWorkflowIds: string[]) { + async update(id: number, attrs: TestDefinitionLike) { if (attrs.name) { const updatedTest = this.toEntity(attrs); await validateEntity(updatedTest); 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 ef24d5570e..5d75b21ffd 100644 --- a/packages/cli/test/integration/evaluation/test-definitions.api.test.ts +++ b/packages/cli/test/integration/evaluation/test-definitions.api.test.ts @@ -223,6 +223,21 @@ describe('PATCH /evaluation/test-definitions/:id', () => { expect(resp.body.data.name).toBe('updated-test'); }); + test('should return 404 if user has no access to the workflow', async () => { + const newTest = Container.get(TestDefinitionRepository).create({ + name: 'test', + workflow: { id: otherWorkflow.id }, + }); + await Container.get(TestDefinitionRepository).save(newTest); + + const resp = await authOwnerAgent.patch(`/evaluation/test-definitions/${newTest.id}`).send({ + name: 'updated-test', + }); + + expect(resp.statusCode).toBe(404); + expect(resp.body.message).toBe('Test definition not found'); + }); + test('should update test definition with evaluation workflow', async () => { const newTest = Container.get(TestDefinitionRepository).create({ name: 'test',