[
{"fn": "groupByDue", "name": "an empty list has no sections", "args": [[], "2026-09-28"], "expect": []},
{"fn": "groupByDue", "name": "one todo of each kind, in reverse, comes out in section order", "args": [[{"id": "a", "title": "Task a", "notes": null, "done": true, "priority": "none", "due": "2026-09-20", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": "2026-09-27T18:00:00Z", "order": 0}, {"id": "b", "title": "Task b", "notes": null, "done": false, "priority": "none", "due": null, "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "c", "title": "Task c", "notes": null, "done": false, "priority": "none", "due": "2026-10-05", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "d", "title": "Task d", "notes": null, "done": false, "priority": "none", "due": "2026-09-30", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "e", "title": "Task e", "notes": null, "done": false, "priority": "none", "due": "2026-09-29", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "f", "title": "Task f", "notes": null, "done": false, "priority": "none", "due": "2026-09-28", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "g", "title": "Task g", "notes": null, "done": false, "priority": "none", "due": "2026-09-27", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}], "2026-09-28"], "expect": [{"status": "overdue", "title": "Overdue", "todos": [{"id": "g", "title": "Task g", "notes": null, "done": false, "priority": "none", "due": "2026-09-27", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}]}, {"status": "today", "title": "Today", "todos": [{"id": "f", "title": "Task f", "notes": null, "done": false, "priority": "none", "due": "2026-09-28", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}]}, {"status": "tomorrow", "title": "Tomorrow", "todos": [{"id": "e", "title": "Task e", "notes": null, "done": false, "priority": "none", "due": "2026-09-29", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}]}, {"status": "this-week", "title": "This week", "todos": [{"id": "d", "title": "Task d", "notes": null, "done": false, "priority": "none", "due": "2026-09-30", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}]}, {"status": "later", "title": "Later", "todos": [{"id": "c", "title": "Task c", "notes": null, "done": false, "priority": "none", "due": "2026-10-05", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}]}, {"status": "none", "title": "No date", "todos": [{"id": "b", "title": "Task b", "notes": null, "done": false, "priority": "none", "due": null, "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}]}, {"status": "done", "title": "Done", "todos": [{"id": "a", "title": "Task a", "notes": null, "done": true, "priority": "none", "due": "2026-09-20", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": "2026-09-27T18:00:00Z", "order": 0}]}]},
{"fn": "groupByDue", "name": "overdue is sorted by due date, oldest first", "args": [[{"id": "x", "title": "Task x", "notes": null, "done": false, "priority": "none", "due": "2026-09-27", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "y", "title": "Task y", "notes": null, "done": false, "priority": "none", "due": "2026-09-20", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "z", "title": "Task z", "notes": null, "done": false, "priority": "none", "due": "2026-09-25", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}], "2026-09-28"], "expect": [{"status": "overdue", "title": "Overdue", "todos": [{"id": "y", "title": "Task y", "notes": null, "done": false, "priority": "none", "due": "2026-09-20", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "z", "title": "Task z", "notes": null, "done": false, "priority": "none", "due": "2026-09-25", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "x", "title": "Task x", "notes": null, "done": false, "priority": "none", "due": "2026-09-27", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}]}]},
{"fn": "groupByDue", "name": "equal due dates keep their input order (stable)", "args": [[{"id": "p", "title": "Task p", "notes": null, "done": false, "priority": "none", "due": "2026-10-10", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "q", "title": "Task q", "notes": null, "done": false, "priority": "none", "due": "2026-10-06", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "r", "title": "Task r", "notes": null, "done": false, "priority": "none", "due": "2026-10-10", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "s", "title": "Task s", "notes": null, "done": false, "priority": "none", "due": "2026-10-06", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}], "2026-09-28"], "expect": [{"status": "later", "title": "Later", "todos": [{"id": "q", "title": "Task q", "notes": null, "done": false, "priority": "none", "due": "2026-10-06", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "s", "title": "Task s", "notes": null, "done": false, "priority": "none", "due": "2026-10-06", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "p", "title": "Task p", "notes": null, "done": false, "priority": "none", "due": "2026-10-10", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "r", "title": "Task r", "notes": null, "done": false, "priority": "none", "due": "2026-10-10", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}]}]},
{"fn": "groupByDue", "name": "equal overdue dates keep their input order", "args": [[{"id": "o2", "title": "Task o2", "notes": null, "done": false, "priority": "none", "due": "2026-09-27", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "o1", "title": "Task o1", "notes": null, "done": false, "priority": "none", "due": "2026-09-27", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}], "2026-09-28"], "expect": [{"status": "overdue", "title": "Overdue", "todos": [{"id": "o2", "title": "Task o2", "notes": null, "done": false, "priority": "none", "due": "2026-09-27", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "o1", "title": "Task o1", "notes": null, "done": false, "priority": "none", "due": "2026-09-27", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}]}]},
{"fn": "groupByDue", "name": "this week is sorted by due date", "args": [[{"id": "w1", "title": "Task w1", "notes": null, "done": false, "priority": "none", "due": "2026-10-04", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "w2", "title": "Task w2", "notes": null, "done": false, "priority": "none", "due": "2026-09-30", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "w3", "title": "Task w3", "notes": null, "done": false, "priority": "none", "due": "2026-10-02", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}], "2026-09-28"], "expect": [{"status": "this-week", "title": "This week", "todos": [{"id": "w2", "title": "Task w2", "notes": null, "done": false, "priority": "none", "due": "2026-09-30", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "w3", "title": "Task w3", "notes": null, "done": false, "priority": "none", "due": "2026-10-02", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "w1", "title": "Task w1", "notes": null, "done": false, "priority": "none", "due": "2026-10-04", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}]}]},
{"fn": "groupByDue", "name": "today keeps the caller's order", "args": [[{"id": "t3", "title": "Task t3", "notes": null, "done": false, "priority": "none", "due": "2026-09-28", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "t1", "title": "Task t1", "notes": null, "done": false, "priority": "none", "due": "2026-09-28", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "t2", "title": "Task t2", "notes": null, "done": false, "priority": "none", "due": "2026-09-28", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}], "2026-09-28"], "expect": [{"status": "today", "title": "Today", "todos": [{"id": "t3", "title": "Task t3", "notes": null, "done": false, "priority": "none", "due": "2026-09-28", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "t1", "title": "Task t1", "notes": null, "done": false, "priority": "none", "due": "2026-09-28", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "t2", "title": "Task t2", "notes": null, "done": false, "priority": "none", "due": "2026-09-28", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}]}]},
{"fn": "groupByDue", "name": "done keeps the caller's order, whatever the dates", "args": [[{"id": "d1", "title": "Task d1", "notes": null, "done": true, "priority": "none", "due": "2026-10-10", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": "2026-09-27T18:00:00Z", "order": 0}, {"id": "d2", "title": "Task d2", "notes": null, "done": true, "priority": "none", "due": "2026-09-01", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": "2026-09-27T18:00:00Z", "order": 0}, {"id": "d3", "title": "Task d3", "notes": null, "done": true, "priority": "none", "due": null, "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": "2026-09-27T18:00:00Z", "order": 0}], "2026-09-28"], "expect": [{"status": "done", "title": "Done", "todos": [{"id": "d1", "title": "Task d1", "notes": null, "done": true, "priority": "none", "due": "2026-10-10", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": "2026-09-27T18:00:00Z", "order": 0}, {"id": "d2", "title": "Task d2", "notes": null, "done": true, "priority": "none", "due": "2026-09-01", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": "2026-09-27T18:00:00Z", "order": 0}, {"id": "d3", "title": "Task d3", "notes": null, "done": true, "priority": "none", "due": null, "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": "2026-09-27T18:00:00Z", "order": 0}]}]},
{"fn": "groupByDue", "name": "no date keeps the caller's order, and empty sections are left out", "args": [[{"id": "n2", "title": "Task n2", "notes": null, "done": false, "priority": "none", "due": null, "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "t1", "title": "Task t1", "notes": null, "done": false, "priority": "none", "due": "2026-09-28", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "n1", "title": "Task n1", "notes": null, "done": false, "priority": "none", "due": null, "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}], "2026-09-28"], "expect": [{"status": "today", "title": "Today", "todos": [{"id": "t1", "title": "Task t1", "notes": null, "done": false, "priority": "none", "due": "2026-09-28", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}]}, {"status": "none", "title": "No date", "todos": [{"id": "n2", "title": "Task n2", "notes": null, "done": false, "priority": "none", "due": null, "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "n1", "title": "Task n1", "notes": null, "done": false, "priority": "none", "due": null, "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}]}]},
{"fn": "groupByDue", "name": "on Saturday there is no This week: Sunday is tomorrow, Monday is later", "args": [[{"id": "f", "title": "Task f", "notes": null, "done": false, "priority": "none", "due": "2026-10-09", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "m", "title": "Task m", "notes": null, "done": false, "priority": "none", "due": "2026-10-05", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "s", "title": "Task s", "notes": null, "done": false, "priority": "none", "due": "2026-10-04", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}], "2026-10-03"], "expect": [{"status": "tomorrow", "title": "Tomorrow", "todos": [{"id": "s", "title": "Task s", "notes": null, "done": false, "priority": "none", "due": "2026-10-04", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}]}, {"status": "later", "title": "Later", "todos": [{"id": "m", "title": "Task m", "notes": null, "done": false, "priority": "none", "due": "2026-10-05", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "f", "title": "Task f", "notes": null, "done": false, "priority": "none", "due": "2026-10-09", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}]}]},
{"fn": "groupByDue", "name": "a list that is all done is one Done section", "args": [[{"id": "d2", "title": "Task d2", "notes": null, "done": true, "priority": "none", "due": "2026-09-01", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": "2026-09-27T18:00:00Z", "order": 0}, {"id": "d3", "title": "Task d3", "notes": null, "done": true, "priority": "none", "due": null, "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": "2026-09-27T18:00:00Z", "order": 0}], "2026-09-28"], "expect": [{"status": "done", "title": "Done", "todos": [{"id": "d2", "title": "Task d2", "notes": null, "done": true, "priority": "none", "due": "2026-09-01", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": "2026-09-27T18:00:00Z", "order": 0}, {"id": "d3", "title": "Task d3", "notes": null, "done": true, "priority": "none", "due": null, "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": "2026-09-27T18:00:00Z", "order": 0}]}]},
{"fn": "groupByDue", "name": "a malformed today is an error even for an empty list", "args": [[], "2026-9-28"], "expectError": "is not an ISO date"},
{"fn": "groupByDue", "name": "today with a trailing newline", "args": [[{"id": "f", "title": "Task f", "notes": null, "done": false, "priority": "none", "due": "2026-09-28", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}], "2026-09-28\n"], "expectError": "is not an ISO date"},
{"fn": "groupByDue", "name": "a due date that never existed", "args": [[{"id": "f", "title": "Task f", "notes": null, "done": false, "priority": "none", "due": "2026-09-28", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "bad", "title": "Task bad", "notes": null, "done": false, "priority": "none", "due": "2026-13-01", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}], "2026-09-28"], "expectError": "is not a real calendar date"},
{"fn": "groupByDueWithOrder", "name": "input keeps overdue in the caller's order, not by date", "args": [[{"id": "a", "title": "Task a", "notes": null, "done": false, "priority": "none", "due": "2026-09-25", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "b", "title": "Task b", "notes": null, "done": false, "priority": "none", "due": "2026-09-20", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}], "2026-09-28", "input"], "expect": [{"status": "overdue", "title": "Overdue", "todos": [{"id": "a", "title": "Task a", "notes": null, "done": false, "priority": "none", "due": "2026-09-25", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "b", "title": "Task b", "notes": null, "done": false, "priority": "none", "due": "2026-09-20", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}]}]},
{"fn": "groupByDueWithOrder", "name": "due sorts the same overdue todos oldest first, as groupByDue does", "args": [[{"id": "a", "title": "Task a", "notes": null, "done": false, "priority": "none", "due": "2026-09-25", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "b", "title": "Task b", "notes": null, "done": false, "priority": "none", "due": "2026-09-20", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}], "2026-09-28", "due"], "expect": [{"status": "overdue", "title": "Overdue", "todos": [{"id": "b", "title": "Task b", "notes": null, "done": false, "priority": "none", "due": "2026-09-20", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "a", "title": "Task a", "notes": null, "done": false, "priority": "none", "due": "2026-09-25", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}]}]},
{"fn": "groupByDueWithOrder", "name": "input keeps this week in the caller's order", "args": [[{"id": "x", "title": "Task x", "notes": null, "done": false, "priority": "none", "due": "2026-10-02", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "y", "title": "Task y", "notes": null, "done": false, "priority": "none", "due": "2026-09-30", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}], "2026-09-28", "input"], "expect": [{"status": "this-week", "title": "This week", "todos": [{"id": "x", "title": "Task x", "notes": null, "done": false, "priority": "none", "due": "2026-10-02", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "y", "title": "Task y", "notes": null, "done": false, "priority": "none", "due": "2026-09-30", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}]}]},
{"fn": "groupByDueWithOrder", "name": "input keeps later in the caller's order", "args": [[{"id": "p", "title": "Task p", "notes": null, "done": false, "priority": "none", "due": "2026-11-01", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "q", "title": "Task q", "notes": null, "done": false, "priority": "none", "due": "2026-10-05", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "r", "title": "Task r", "notes": null, "done": false, "priority": "none", "due": "2026-12-25", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}], "2026-09-28", "input"], "expect": [{"status": "later", "title": "Later", "todos": [{"id": "p", "title": "Task p", "notes": null, "done": false, "priority": "none", "due": "2026-11-01", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "q", "title": "Task q", "notes": null, "done": false, "priority": "none", "due": "2026-10-05", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "r", "title": "Task r", "notes": null, "done": false, "priority": "none", "due": "2026-12-25", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}]}]},
{"fn": "groupByDueWithOrder", "name": "due sorts later by date", "args": [[{"id": "p", "title": "Task p", "notes": null, "done": false, "priority": "none", "due": "2026-11-01", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "q", "title": "Task q", "notes": null, "done": false, "priority": "none", "due": "2026-10-05", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "r", "title": "Task r", "notes": null, "done": false, "priority": "none", "due": "2026-12-25", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}], "2026-09-28", "due"], "expect": [{"status": "later", "title": "Later", "todos": [{"id": "q", "title": "Task q", "notes": null, "done": false, "priority": "none", "due": "2026-10-05", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "p", "title": "Task p", "notes": null, "done": false, "priority": "none", "due": "2026-11-01", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "r", "title": "Task r", "notes": null, "done": false, "priority": "none", "due": "2026-12-25", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}]}]},
{"fn": "groupByDueWithOrder", "name": "input still puts the sections in their fixed order", "args": [[{"id": "n", "title": "Task n", "notes": null, "done": false, "priority": "none", "due": null, "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "d", "title": "Task d", "notes": null, "done": true, "priority": "none", "due": "2026-09-20", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": "2026-09-27T18:00:00Z", "order": 0}, {"id": "l", "title": "Task l", "notes": null, "done": false, "priority": "none", "due": "2026-10-05", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "o", "title": "Task o", "notes": null, "done": false, "priority": "none", "due": "2026-09-27", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "m", "title": "Task m", "notes": null, "done": false, "priority": "none", "due": "2026-09-29", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "k", "title": "Task k", "notes": null, "done": false, "priority": "none", "due": "2026-09-28", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}], "2026-09-28", "input"], "expect": [{"status": "overdue", "title": "Overdue", "todos": [{"id": "o", "title": "Task o", "notes": null, "done": false, "priority": "none", "due": "2026-09-27", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}]}, {"status": "today", "title": "Today", "todos": [{"id": "k", "title": "Task k", "notes": null, "done": false, "priority": "none", "due": "2026-09-28", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}]}, {"status": "tomorrow", "title": "Tomorrow", "todos": [{"id": "m", "title": "Task m", "notes": null, "done": false, "priority": "none", "due": "2026-09-29", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}]}, {"status": "later", "title": "Later", "todos": [{"id": "l", "title": "Task l", "notes": null, "done": false, "priority": "none", "due": "2026-10-05", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}]}, {"status": "none", "title": "No date", "todos": [{"id": "n", "title": "Task n", "notes": null, "done": false, "priority": "none", "due": null, "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}]}, {"status": "done", "title": "Done", "todos": [{"id": "d", "title": "Task d", "notes": null, "done": true, "priority": "none", "due": "2026-09-20", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": "2026-09-27T18:00:00Z", "order": 0}]}]},
{"fn": "groupByDueWithOrder", "name": "an empty list has no sections", "args": [[], "2026-09-28", "input"], "expect": []},
{"fn": "groupByDueWithOrder", "name": "a list sorted by priority stays in priority order inside overdue", "args": [[{"id": "h", "title": "Task h", "notes": null, "done": false, "priority": "high", "due": "2026-09-27", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "lo", "title": "Task lo", "notes": null, "done": false, "priority": "low", "due": "2026-09-01", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}], "2026-09-28", "input"], "expect": [{"status": "overdue", "title": "Overdue", "todos": [{"id": "h", "title": "Task h", "notes": null, "done": false, "priority": "high", "due": "2026-09-27", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "lo", "title": "Task lo", "notes": null, "done": false, "priority": "low", "due": "2026-09-01", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}]}]},
{"fn": "groupByDueWithOrder", "name": "due keeps equal dates in input order (stable)", "args": [[{"id": "e1", "title": "Task e1", "notes": null, "done": false, "priority": "none", "due": "2026-10-10", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "e0", "title": "Task e0", "notes": null, "done": false, "priority": "none", "due": "2026-10-06", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "e2", "title": "Task e2", "notes": null, "done": false, "priority": "none", "due": "2026-10-10", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}], "2026-09-28", "due"], "expect": [{"status": "later", "title": "Later", "todos": [{"id": "e0", "title": "Task e0", "notes": null, "done": false, "priority": "none", "due": "2026-10-06", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "e1", "title": "Task e1", "notes": null, "done": false, "priority": "none", "due": "2026-10-10", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "e2", "title": "Task e2", "notes": null, "done": false, "priority": "none", "due": "2026-10-10", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}]}]},
{"fn": "groupByDueWithOrder", "name": "manual order across several sections: each keeps its members' input order", "args": [[{"id": "s3", "title": "Task s3", "notes": null, "done": false, "priority": "none", "due": "2026-10-20", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "s1", "title": "Task s1", "notes": null, "done": false, "priority": "none", "due": "2026-09-26", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "s4", "title": "Task s4", "notes": null, "done": false, "priority": "none", "due": "2026-10-06", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "s2", "title": "Task s2", "notes": null, "done": false, "priority": "none", "due": "2026-09-10", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}], "2026-09-28", "input"], "expect": [{"status": "overdue", "title": "Overdue", "todos": [{"id": "s1", "title": "Task s1", "notes": null, "done": false, "priority": "none", "due": "2026-09-26", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "s2", "title": "Task s2", "notes": null, "done": false, "priority": "none", "due": "2026-09-10", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}]}, {"status": "later", "title": "Later", "todos": [{"id": "s3", "title": "Task s3", "notes": null, "done": false, "priority": "none", "due": "2026-10-20", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, {"id": "s4", "title": "Task s4", "notes": null, "done": false, "priority": "none", "due": "2026-10-06", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}]}]},
{"fn": "groupByDueWithOrder", "name": "a malformed today is an error even for an empty list", "args": [[], "28/09/2026", "input"], "expectError": "is not an ISO date"},
{"fn": "groupByDueWithOrder", "name": "an unknown order is an error", "args": [[], "2026-09-28", "manual"], "expectError": "order must be \"due\" or \"input\""}
]