From 46b4f65da09f0f1290a2f95ccf3e1c0ed4716209 Mon Sep 17 00:00:00 2001 From: kolaente Date: Tue, 30 Sep 2025 16:49:32 +0200 Subject: [PATCH] fix(test): prune leftover task duplicates --- .../e2e/task/subtask-duplicates.spec.ts | 10 ++++++---- frontend/cypress/factories/task_relation.ts | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 frontend/cypress/factories/task_relation.ts diff --git a/frontend/cypress/e2e/task/subtask-duplicates.spec.ts b/frontend/cypress/e2e/task/subtask-duplicates.spec.ts index 293a15759..9d40c804c 100644 --- a/frontend/cypress/e2e/task/subtask-duplicates.spec.ts +++ b/frontend/cypress/e2e/task/subtask-duplicates.spec.ts @@ -2,6 +2,7 @@ import {createFakeUserAndLogin} from '../../support/authenticateUser' import {ProjectFactory} from '../../factories/project' import {TaskFactory} from '../../factories/task' import {ProjectViewFactory} from '../../factories/project_view' +import {TaskRelationFactory} from '../../factories/task_relation' function createViews(projectId: number, projectViewId: number) { return ProjectViewFactory.create(1, { @@ -20,10 +21,11 @@ describe('Subtask duplicate handling', () => { let parentB let subtask - beforeEach(() => { - ProjectFactory.truncate() - ProjectViewFactory.truncate() - TaskFactory.truncate() + beforeEach(() => { + ProjectFactory.truncate() + ProjectViewFactory.truncate() + TaskFactory.truncate() + TaskRelationFactory.truncate() projectA = ProjectFactory.create(1, {id: 1, title: 'Project A'})[0] createViews(projectA.id, 1) diff --git a/frontend/cypress/factories/task_relation.ts b/frontend/cypress/factories/task_relation.ts new file mode 100644 index 000000000..2c1007ada --- /dev/null +++ b/frontend/cypress/factories/task_relation.ts @@ -0,0 +1,18 @@ +import {Factory} from '../support/factory' + +export class TaskRelationFactory extends Factory { + static table = 'task_relations' + + static factory() { + const now = new Date() + + return { + id: '{increment}', + task_id: '{increment}', + other_task_id: '{increment}', + relation_kind: 'related', + created_by_id: 1, + created: now.toISOString(), + } + } +}