Functional Weave
Code in Python

todo.tag-counts@1.0.0

vectors.json

6,278 bytes · view raw

[
  {"name": "open todos only: ties go alphabetically", "args": [[{"id": "a", "title": "Buy milk", "notes": null, "done": false, "priority": "none", "due": null, "tags": ["home", "errands"], "recurrence": null, "createdAt": "2026-09-20T09:00:00Z", "completedAt": null, "order": 0}, {"id": "b", "title": "Buy milk", "notes": null, "done": true, "priority": "none", "due": null, "tags": ["home", "bills"], "recurrence": null, "createdAt": "2026-09-20T09:00:00Z", "completedAt": "2026-09-27T18:00:00Z", "order": 0}, {"id": "c", "title": "Buy milk", "notes": null, "done": false, "priority": "none", "due": null, "tags": ["work", "home"], "recurrence": null, "createdAt": "2026-09-20T09:00:00Z", "completedAt": null, "order": 0}, {"id": "d", "title": "Buy milk", "notes": null, "done": false, "priority": "none", "due": null, "tags": [], "recurrence": null, "createdAt": "2026-09-20T09:00:00Z", "completedAt": null, "order": 0}, {"id": "e", "title": "Buy milk", "notes": null, "done": true, "priority": "none", "due": null, "tags": ["work"], "recurrence": null, "createdAt": "2026-09-20T09:00:00Z", "completedAt": "2026-09-27T18:00:00Z", "order": 0}, {"id": "f", "title": "Buy milk", "notes": null, "done": false, "priority": "none", "due": null, "tags": ["errands"], "recurrence": null, "createdAt": "2026-09-20T09:00:00Z", "completedAt": null, "order": 0}], false], "expect": [{"tag": "errands", "count": 2}, {"tag": "home", "count": 2}, {"tag": "work", "count": 1}]},
  {"name": "including done todos adds bills and more home and work", "args": [[{"id": "a", "title": "Buy milk", "notes": null, "done": false, "priority": "none", "due": null, "tags": ["home", "errands"], "recurrence": null, "createdAt": "2026-09-20T09:00:00Z", "completedAt": null, "order": 0}, {"id": "b", "title": "Buy milk", "notes": null, "done": true, "priority": "none", "due": null, "tags": ["home", "bills"], "recurrence": null, "createdAt": "2026-09-20T09:00:00Z", "completedAt": "2026-09-27T18:00:00Z", "order": 0}, {"id": "c", "title": "Buy milk", "notes": null, "done": false, "priority": "none", "due": null, "tags": ["work", "home"], "recurrence": null, "createdAt": "2026-09-20T09:00:00Z", "completedAt": null, "order": 0}, {"id": "d", "title": "Buy milk", "notes": null, "done": false, "priority": "none", "due": null, "tags": [], "recurrence": null, "createdAt": "2026-09-20T09:00:00Z", "completedAt": null, "order": 0}, {"id": "e", "title": "Buy milk", "notes": null, "done": true, "priority": "none", "due": null, "tags": ["work"], "recurrence": null, "createdAt": "2026-09-20T09:00:00Z", "completedAt": "2026-09-27T18:00:00Z", "order": 0}, {"id": "f", "title": "Buy milk", "notes": null, "done": false, "priority": "none", "due": null, "tags": ["errands"], "recurrence": null, "createdAt": "2026-09-20T09:00:00Z", "completedAt": null, "order": 0}], true], "expect": [{"tag": "home", "count": 3}, {"tag": "errands", "count": 2}, {"tag": "work", "count": 2}, {"tag": "bills", "count": 1}]},
  {"name": "an empty list has no tags", "args": [[], true], "expect": []},
  {"name": "tags only on done todos are left out, not counted as zero", "args": [[{"id": "b", "title": "Buy milk", "notes": null, "done": true, "priority": "none", "due": null, "tags": ["home", "bills"], "recurrence": null, "createdAt": "2026-09-20T09:00:00Z", "completedAt": "2026-09-27T18:00:00Z", "order": 0}, {"id": "e", "title": "Buy milk", "notes": null, "done": true, "priority": "none", "due": null, "tags": ["work"], "recurrence": null, "createdAt": "2026-09-20T09:00:00Z", "completedAt": "2026-09-27T18:00:00Z", "order": 0}], false], "expect": []},
  {"name": "todos without tags", "args": [[{"id": "d", "title": "Buy milk", "notes": null, "done": false, "priority": "none", "due": null, "tags": [], "recurrence": null, "createdAt": "2026-09-20T09:00:00Z", "completedAt": null, "order": 0}, {"id": "g", "title": "Buy milk", "notes": null, "done": false, "priority": "none", "due": null, "tags": [], "recurrence": null, "createdAt": "2026-09-20T09:00:00Z", "completedAt": null, "order": 0}], true], "expect": []},
  {"name": "a tag repeated on one todo counts once", "args": [[{"id": "h", "title": "Buy milk", "notes": null, "done": false, "priority": "none", "due": null, "tags": ["home", "home"], "recurrence": null, "createdAt": "2026-09-20T09:00:00Z", "completedAt": null, "order": 0}], true], "expect": [{"tag": "home", "count": 1}]},
  {"name": "ties are code-point order, not natural order: b-2, b10, b2", "args": [[{"id": "i", "title": "Buy milk", "notes": null, "done": false, "priority": "none", "due": null, "tags": ["b2", "b10", "a", "b-2"], "recurrence": null, "createdAt": "2026-09-20T09:00:00Z", "completedAt": null, "order": 0}], false], "expect": [{"tag": "a", "count": 1}, {"tag": "b-2", "count": 1}, {"tag": "b10", "count": 1}, {"tag": "b2", "count": 1}]},
  {"name": "count beats alphabet", "args": [[{"id": "j", "title": "Buy milk", "notes": null, "done": false, "priority": "none", "due": null, "tags": ["aa", "zz"], "recurrence": null, "createdAt": "2026-09-20T09:00:00Z", "completedAt": null, "order": 0}, {"id": "k", "title": "Buy milk", "notes": null, "done": false, "priority": "none", "due": null, "tags": ["zz"], "recurrence": null, "createdAt": "2026-09-20T09:00:00Z", "completedAt": null, "order": 0}, {"id": "l", "title": "Buy milk", "notes": null, "done": false, "priority": "none", "due": null, "tags": ["zz"], "recurrence": null, "createdAt": "2026-09-20T09:00:00Z", "completedAt": null, "order": 0}], false], "expect": [{"tag": "zz", "count": 3}, {"tag": "aa", "count": 1}]},
  {"name": "one todo's tags come out alphabetically, not in its own order", "args": [[{"id": "m", "title": "Buy milk", "notes": null, "done": false, "priority": "none", "due": null, "tags": ["work", "home"], "recurrence": null, "createdAt": "2026-09-20T09:00:00Z", "completedAt": null, "order": 0}], false], "expect": [{"tag": "home", "count": 1}, {"tag": "work", "count": 1}]},
  {"name": "a done todo counts when asked", "args": [[{"id": "n", "title": "Buy milk", "notes": null, "done": true, "priority": "none", "due": null, "tags": ["work"], "recurrence": null, "createdAt": "2026-09-20T09:00:00Z", "completedAt": "2026-09-27T18:00:00Z", "order": 0}], true], "expect": [{"tag": "work", "count": 1}]}
]