This commit is contained in:
@@ -8,6 +8,7 @@ type SearchTask = {
|
||||
parent_id?: string | null
|
||||
completed?: boolean
|
||||
list_name?: string
|
||||
subtasks?: SearchTask[]
|
||||
}
|
||||
|
||||
const tasks: SearchTask[] = [
|
||||
@@ -26,6 +27,12 @@ describe('task utilities', () => {
|
||||
expect(groupTaskTree(tasks)).toEqual([{ task: tasks[0], subtasks: [tasks[1]] }, { task: tasks[2], subtasks: [] }])
|
||||
})
|
||||
|
||||
it('preserves subtasks already nested by the task API', () => {
|
||||
const child: SearchTask = { id: 'nested-child', title: 'Nested child', parent_id: 'nested-parent' }
|
||||
const parent: SearchTask = { id: 'nested-parent', title: 'Nested parent', parent_id: null, subtasks: [child] }
|
||||
expect(groupTaskTree([parent])).toEqual([{ task: parent, subtasks: [child] }])
|
||||
})
|
||||
|
||||
it('moves an item before or after another item without changing other scopes', () => {
|
||||
const rows = [
|
||||
{ id: 'a', parent_id: null },
|
||||
|
||||
Reference in New Issue
Block a user