Functional Weave
Code in Python

todo.reschedule-recurrence@1.0.0

vectors.json

2,954 bytes · view raw

[
  {"name": "moving a monthly todo's date moves the series to the new date", "args": [{"frequency": "monthly", "interval": 1, "anchor": "2026-09-29"}, "2026-09-29", "2026-10-05"], "expect": {"frequency": "monthly", "interval": 1, "anchor": "2026-10-05"}},
  {"name": "moving it earlier than the anchor, which todo.item would otherwise refuse", "args": [{"frequency": "weekly", "interval": 1, "anchor": "2026-10-01"}, "2026-10-01", "2026-09-28"], "expect": {"frequency": "weekly", "interval": 1, "anchor": "2026-09-28"}},
  {"name": "an unchanged date keeps a month-end anchor after the series rolled forward", "args": [{"frequency": "monthly", "interval": 1, "anchor": "2026-01-31"}, "2026-02-28", "2026-02-28"], "expect": {"frequency": "monthly", "interval": 1, "anchor": "2026-01-31"}},
  {"name": "a rolled-forward series moved by two days is anchored on the new date, not the old anchor", "args": [{"frequency": "monthly", "interval": 1, "anchor": "2026-01-31"}, "2026-02-28", "2026-03-02"], "expect": {"frequency": "monthly", "interval": 1, "anchor": "2026-03-02"}},
  {"name": "frequency and interval are kept", "args": [{"frequency": "weekly", "interval": 2, "anchor": "2026-09-28"}, "2026-09-28", "2026-10-02"], "expect": {"frequency": "weekly", "interval": 2, "anchor": "2026-10-02"}},
  {"name": "a one-off todo stays one-off", "args": [null, "2026-09-28", "2026-10-01"], "expect": null},
  {"name": "clearing the date leaves the repeat for todo.item to report", "args": [{"frequency": "daily", "interval": 1, "anchor": "2026-09-28"}, "2026-09-28", null], "expect": {"frequency": "daily", "interval": 1, "anchor": "2026-09-28"}},
  {"name": "a repeat that had no date gets one: the new date is the anchor", "args": [{"frequency": "daily", "interval": 1, "anchor": "2026-09-28"}, null, "2026-10-01"], "expect": {"frequency": "daily", "interval": 1, "anchor": "2026-10-01"}},
  {"name": "a weekday series moved to a Saturday is anchored there as given", "args": [{"frequency": "weekdays", "interval": 1, "anchor": "2026-09-28"}, "2026-09-30", "2026-10-03"], "expect": {"frequency": "weekdays", "interval": 1, "anchor": "2026-10-03"}},
  {"name": "no dates at all and no repeat", "args": [null, null, null], "expect": null},
  {"name": "an impossible new date is an error", "args": [{"frequency": "daily", "interval": 1, "anchor": "2026-09-28"}, "2026-09-28", "2026-02-30"], "expectError": "is not a real calendar date"},
  {"name": "a malformed old date is an error", "args": [{"frequency": "daily", "interval": 1, "anchor": "2026-09-28"}, "28/09/2026", "2026-10-01"], "expectError": "is not an ISO date"},
  {"name": "a malformed anchor is an error", "args": [{"frequency": "monthly", "interval": 1, "anchor": "2026-13-01"}, "2026-09-28", "2026-10-01"], "expectError": "is not a real calendar date"},
  {"name": "a bad date is an error even for a one-off todo", "args": [null, "2026-09-28", "2026-9-30"], "expectError": "is not an ISO date"}
]