test: add edge case tests

This commit is contained in:
2026-07-18 07:13:51 +05:00
parent 3b34171ea0
commit f57b181e99
7 changed files with 177 additions and 0 deletions
+27
View File
@@ -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"]);
});
});