[ {"name": "a clock that starts on the measuring date has waited zero days, in the 0-1 week band", "args": ["2026-01-05", null, "2026-01-05"], "expect": {"days": 0, "completedWeeks": 0, "weekBand": 1, "breached18Weeks": false, "eighteenWeekDate": "2026-05-11", "clockStopped": false}}, {"name": "7 days is still the 0-1 week band, which holds eight days", "args": ["2026-01-05", null, "2026-01-12"], "expect": {"days": 7, "completedWeeks": 1, "weekBand": 1, "breached18Weeks": false, "eighteenWeekDate": "2026-05-11", "clockStopped": false}}, {"name": "8 days is the first day of the 1-2 week band", "args": ["2026-01-05", null, "2026-01-13"], "expect": {"days": 8, "completedWeeks": 1, "weekBand": 2, "breached18Weeks": false, "eighteenWeekDate": "2026-05-11", "clockStopped": false}}, {"name": "exactly 18 weeks (126 days) is in the 17-18 week band and not a breach", "args": ["2026-01-05", null, "2026-05-11"], "expect": {"days": 126, "completedWeeks": 18, "weekBand": 18, "breached18Weeks": false, "eighteenWeekDate": "2026-05-11", "clockStopped": false}}, {"name": "127 days breaches 18 weeks although only 18 whole weeks are completed: a naive completedWeeks > 18 check misses it", "args": ["2026-01-05", null, "2026-05-12"], "expect": {"days": 127, "completedWeeks": 18, "weekBand": 19, "breached18Weeks": true, "eighteenWeekDate": "2026-05-11", "clockStopped": false}}, {"name": "125 days: 17 completed weeks, band 18", "args": ["2026-01-05", null, "2026-05-10"], "expect": {"days": 125, "completedWeeks": 17, "weekBand": 18, "breached18Weeks": false, "eighteenWeekDate": "2026-05-11", "clockStopped": false}}, {"name": "728 days is the 103-104 week band", "args": ["2026-01-05", null, "2028-01-03"], "expect": {"days": 728, "completedWeeks": 104, "weekBand": 104, "breached18Weeks": true, "eighteenWeekDate": "2026-05-11", "clockStopped": false}}, {"name": "729 days is beyond 104 weeks", "args": ["2026-01-05", null, "2028-01-04"], "expect": {"days": 729, "completedWeeks": 104, "weekBand": 105, "breached18Weeks": true, "eighteenWeekDate": "2026-05-11", "clockStopped": false}}, {"name": "a stopped clock is measured to the stop, not to onDate", "args": ["2026-01-05", "2026-04-20", "2026-09-23"], "expect": {"days": 105, "completedWeeks": 15, "weekBand": 15, "breached18Weeks": false, "eighteenWeekDate": "2026-05-11", "clockStopped": true}}, {"name": "started and stopped on the same day: zero days, still a pathway", "args": ["2026-03-02", "2026-03-02", "2026-03-10"], "expect": {"days": 0, "completedWeeks": 0, "weekBand": 1, "breached18Weeks": false, "eighteenWeekDate": "2026-07-06", "clockStopped": true}}, {"name": "stopped on the measuring date itself", "args": ["2026-01-05", "2026-05-12", "2026-05-12"], "expect": {"days": 127, "completedWeeks": 18, "weekBand": 19, "breached18Weeks": true, "eighteenWeekDate": "2026-05-11", "clockStopped": true}}, {"name": "the 18-week date crosses 29 February in a leap year", "args": ["2027-11-01", null, "2028-03-06"], "expect": {"days": 126, "completedWeeks": 18, "weekBand": 18, "breached18Weeks": false, "eighteenWeekDate": "2028-03-06", "clockStopped": false}}, {"name": "the same span in a common year is a day shorter", "args": ["2026-11-01", null, "2027-03-06"], "expect": {"days": 125, "completedWeeks": 17, "weekBand": 18, "breached18Weeks": false, "eighteenWeekDate": "2027-03-07", "clockStopped": false}}, {"name": "onDate before the clock start is an error", "args": ["2026-01-05", null, "2026-01-04"], "expectError": "is before clockStart"}, {"name": "a clock stop before the start is an error", "args": ["2026-01-05", "2026-01-01", "2026-02-01"], "expectError": "clockStop 2026-01-01 is before clockStart"}, {"name": "a clock stop after onDate is an error: the stop has not happened yet", "args": ["2026-01-05", "2026-03-01", "2026-02-01"], "expectError": "is after onDate"}, {"name": "an impossible date is an error", "args": ["2026-02-30", null, "2026-04-01"], "expectError": "is not a real calendar date"}, {"name": "a UK-style date is an error", "args": ["05/01/2026", null, "2026-04-01"], "expectError": "is not an ISO date"} ]