mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-14 08:34:07 -08:00
wip: fix lint issue, more tests
This commit is contained in:
parent
bc470baee0
commit
3a4fd24d19
|
@ -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);
|
||||
|
|
|
@ -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',
|
||||
|
|
Loading…
Reference in a new issue