Functional Weave
Code in TypeScript

todo.due-label@1.0.0

vectors.json

6,442 bytes · view raw

[
  {"name": "a done todo shows nothing, even when its date has passed", "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}, "2026-09-28"], "expect": ""},
  {"name": "a done todo with no date shows nothing", "args": [{"id": "a", "title": "Task a", "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": ""},
  {"name": "no due date shows nothing", "args": [{"id": "a", "title": "Task a", "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": ""},
  {"name": "one day late is singular", "args": [{"id": "a", "title": "Task a", "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": "1 day overdue"},
  {"name": "ten days late", "args": [{"id": "a", "title": "Task a", "notes": null, "done": false, "priority": "none", "due": "2026-09-18", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, "2026-09-28"], "expect": "10 days overdue"},
  {"name": "due last New Year's Eve is 271 days overdue", "args": [{"id": "a", "title": "Task a", "notes": null, "done": false, "priority": "none", "due": "2025-12-31", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, "2026-09-28"], "expect": "271 days overdue"},
  {"name": "due today", "args": [{"id": "a", "title": "Task a", "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": "Due today"},
  {"name": "due tomorrow", "args": [{"id": "a", "title": "Task a", "notes": null, "done": false, "priority": "none", "due": "2026-09-29", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, "2026-09-28"], "expect": "Due tomorrow"},
  {"name": "Friday this week, seen on Monday", "args": [{"id": "a", "title": "Task a", "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": "Due Fri 2 Oct"},
  {"name": "Sunday is still this week", "args": [{"id": "a", "title": "Task a", "notes": null, "done": false, "priority": "none", "due": "2026-10-04", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, "2026-09-28"], "expect": "Due Sun 4 Oct"},
  {"name": "next Monday is later, same format", "args": [{"id": "a", "title": "Task a", "notes": null, "done": false, "priority": "none", "due": "2026-10-05", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, "2026-09-28"], "expect": "Due Mon 5 Oct"},
  {"name": "the day has no leading zero", "args": [{"id": "a", "title": "Task a", "notes": null, "done": false, "priority": "none", "due": "2026-11-09", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, "2026-09-28"], "expect": "Due Mon 9 Nov"},
  {"name": "a date next year carries the year", "args": [{"id": "a", "title": "Task a", "notes": null, "done": false, "priority": "none", "due": "2027-01-01", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, "2026-09-28"], "expect": "Due Fri 1 Jan 2027"},
  {"name": "on Thursday 31 December, Sunday 3 January is this week and carries the year", "args": [{"id": "a", "title": "Task a", "notes": null, "done": false, "priority": "none", "due": "2027-01-03", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, "2026-12-31"], "expect": "Due Sun 3 Jan 2027"},
  {"name": "on New Year's Day, New Year's Eve is 1 day overdue", "args": [{"id": "a", "title": "Task a", "notes": null, "done": false, "priority": "none", "due": "2026-12-31", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, "2027-01-01"], "expect": "1 day overdue"},
  {"name": "on Saturday, Sunday is tomorrow", "args": [{"id": "a", "title": "Task a", "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": "Due tomorrow"},
  {"name": "on Saturday, Monday is later", "args": [{"id": "a", "title": "Task a", "notes": null, "done": false, "priority": "none", "due": "2026-10-05", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, "2026-10-03"], "expect": "Due Mon 5 Oct"},
  {"name": "today in the wrong format", "args": [{"id": "a", "title": "Task a", "notes": null, "done": false, "priority": "none", "due": "2026-10-02", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, "28/09/2026"], "expectError": "is not an ISO date"},
  {"name": "today with a trailing newline", "args": [{"id": "a", "title": "Task a", "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\n"], "expectError": "is not an ISO date"},
  {"name": "a due date that never existed", "args": [{"id": "a", "title": "Task a", "notes": null, "done": false, "priority": "none", "due": "2026-02-30", "tags": [], "recurrence": null, "createdAt": "2026-09-01T09:00:00Z", "completedAt": null, "order": 0}, "2026-09-28"], "expectError": "is not a real calendar date"},
  {"name": "a bad today is an error even on a done todo", "args": [{"id": "a", "title": "Task a", "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-9-28"], "expectError": "is not an ISO date"}
]