feat(tracker): polish UI sorting and formatting (#22437)

This commit is contained in:
anj-s
2026-03-16 12:18:01 -07:00
committed by GitHub
parent 05fda0cf01
commit bba9c07541
3 changed files with 58 additions and 10 deletions
+39 -4
View File
@@ -186,20 +186,55 @@ describe('Tracker Tools Integration', () => {
expect(display.todos).toEqual([
{
description: `[p1] [TASK] Parent`,
description: `task: Parent (p1)`,
status: 'in_progress',
},
{
description: ` [c1] [EPIC] Child`,
description: ` epic: Child (c1)`,
status: 'pending',
},
{
description: ` [leaf] [BUG] Closed Leaf`,
description: ` bug: Closed Leaf (leaf)`,
status: 'completed',
},
]);
});
it('sorts tasks by status', async () => {
const t1 = {
id: 't1',
title: 'T1',
type: TaskType.TASK,
status: TaskStatus.CLOSED,
dependencies: [],
};
const t2 = {
id: 't2',
title: 'T2',
type: TaskType.TASK,
status: TaskStatus.OPEN,
dependencies: [],
};
const t3 = {
id: 't3',
title: 'T3',
type: TaskType.TASK,
status: TaskStatus.IN_PROGRESS,
dependencies: [],
};
const mockService = {
listTasks: async () => [t1, t2, t3],
} as unknown as TrackerService;
const display = await buildTodosReturnDisplay(mockService);
expect(display.todos).toEqual([
{ description: `task: T3 (t3)`, status: 'in_progress' },
{ description: `task: T2 (t2)`, status: 'pending' },
{ description: `task: T1 (t1)`, status: 'completed' },
]);
});
it('detects cycles', async () => {
// Since TrackerTask only has a single parentId, a true cycle is unreachable from roots.
// We simulate a database corruption (two tasks with same ID, one root, one child)
@@ -220,7 +255,7 @@ describe('Tracker Tools Integration', () => {
expect(display.todos).toEqual([
{
description: `[p1] [TASK] Parent`,
description: `task: Parent (p1)`,
status: 'pending',
},
{