test: add failing tests for subtask visibility in filtered views

Add test cases to verify that subtasks are shown in saved filter views
regardless of whether their parent task is also in the results.

Ref: #2494
This commit is contained in:
kolaente 2026-04-02 18:55:52 +02:00 committed by kolaente
parent 174c67cfd8
commit 616ac8b95f
1 changed files with 48 additions and 0 deletions

View File

@ -177,4 +177,52 @@ describe('shouldShowTaskInListView', () => {
expect(shouldShowTaskInListView(subtask as ITask, allTasks)).toBe(false)
})
it('should show subtasks in filtered views even when parent is in the same view', () => {
const parentTask: Partial<ITask> = {
id: 1,
title: 'Parent Task',
projectId: 100,
relatedTasks: {},
}
const subtask: Partial<ITask> = {
id: 2,
title: 'Subtask',
projectId: 100,
relatedTasks: {
parenttask: [{
id: 1,
title: 'Parent Task',
projectId: 100,
} as ITask],
},
}
const allTasks = [parentTask, subtask] as ITask[]
// In a filtered view, both parent and subtask should be visible
expect(shouldShowTaskInListView(parentTask as ITask, allTasks, true)).toBe(true)
expect(shouldShowTaskInListView(subtask as ITask, allTasks, true)).toBe(true)
})
it('should show subtasks in filtered views even when only subtask matches filter', () => {
const subtask: Partial<ITask> = {
id: 2,
title: 'Subtask matching filter',
projectId: 100,
relatedTasks: {
parenttask: [{
id: 1,
title: 'Parent Task',
projectId: 100,
} as ITask],
},
}
// Only the subtask is in the results (parent didn't match filter)
const allTasks = [subtask] as ITask[]
expect(shouldShowTaskInListView(subtask as ITask, allTasks, true)).toBe(true)
})
})