test: add edge case tests
This commit is contained in:
@@ -117,4 +117,31 @@ describe("buildKanbanBoard", () => {
|
||||
expect(col.tasks).toEqual([]);
|
||||
}
|
||||
});
|
||||
|
||||
it("preserves input order for tasks with same updated timestamp (stable sort)", () => {
|
||||
const sameUpdated = "2026-01-01T00:00:00.000Z";
|
||||
const tasks: Task[] = [
|
||||
task({
|
||||
id: "a",
|
||||
title: "A",
|
||||
status: TaskStatus.TODO,
|
||||
updated: sameUpdated,
|
||||
}),
|
||||
task({
|
||||
id: "b",
|
||||
title: "B",
|
||||
status: TaskStatus.TODO,
|
||||
updated: sameUpdated,
|
||||
}),
|
||||
task({
|
||||
id: "c",
|
||||
title: "C",
|
||||
status: TaskStatus.TODO,
|
||||
updated: sameUpdated,
|
||||
}),
|
||||
];
|
||||
const board = buildKanbanBoard(tasks);
|
||||
const todo = board.columns.find((col) => col.status === TaskStatus.TODO);
|
||||
expect(todo?.tasks.map((t) => t.id)).toEqual(["a", "b", "c"]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user