wip: fix lint issue, more tests

This commit is contained in:
Eugene Molodkin 2024-11-11 16:15:03 +01:00
parent bc470baee0
commit 3a4fd24d19
No known key found for this signature in database
2 changed files with 16 additions and 1 deletions

View file

@ -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);

View file

@ -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',