[
{"name": "NHS due date calculator: LMP 15 March 2026, 28-day cycle, due 20 December 2026; 12+3 on 10 June", "args": ["2026-03-15", "2026-06-10", 28], "expect": {"weeks": 12, "days": 3, "totalDays": 87, "dueDate": "2026-12-20"}},
{"name": "NHS calculator: a 35-day cycle moves the due date a week later, to 27 December 2026", "args": ["2026-03-15", "2026-06-10", 35], "expect": {"weeks": 11, "days": 3, "totalDays": 80, "dueDate": "2026-12-27"}},
{"name": "NHS calculator: a 21-day cycle moves it a week earlier, to 13 December 2026", "args": ["2026-03-15", "2026-06-10", 21], "expect": {"weeks": 13, "days": 3, "totalDays": 94, "dueDate": "2026-12-13"}},
{"name": "NHS calculator: the shortest cycle it accepts, 20 days, due 12 December 2026", "args": ["2026-03-15", "2026-06-10", 20], "expect": {"weeks": 13, "days": 4, "totalDays": 95, "dueDate": "2026-12-12"}},
{"name": "NHS calculator: a 22-day cycle, due 14 December 2026", "args": ["2026-03-15", "2026-06-10", 22], "expect": {"weeks": 13, "days": 2, "totalDays": 93, "dueDate": "2026-12-14"}},
{"name": "NHS calculator: the longest cycle it accepts, 44 days, due 5 January 2027", "args": ["2026-03-15", "2026-06-10", 44], "expect": {"weeks": 10, "days": 1, "totalDays": 71, "dueDate": "2027-01-05"}},
{"name": "NHS calculator: LMP 31 May 2026, due 7 March 2027", "args": ["2026-05-31", "2026-09-23", 28], "expect": {"weeks": 16, "days": 3, "totalDays": 115, "dueDate": "2027-03-07"}},
{"name": "NHS calculator: LMP 1 January 2026, due 8 October 2026", "args": ["2026-01-01", "2026-09-23", 28], "expect": {"weeks": 37, "days": 6, "totalDays": 265, "dueDate": "2026-10-08"}},
{"name": "NHS calculator: LMP 10 June 2026, due 17 March 2027, on the due date itself 40+0", "args": ["2026-06-10", "2027-03-17", 28], "expect": {"weeks": 40, "days": 0, "totalDays": 280, "dueDate": "2027-03-17"}},
{"name": "NHS calculator: LMP 1 September 2026 with a 30-day cycle, due 10 June 2027", "args": ["2026-09-01", "2026-12-01", 30], "expect": {"weeks": 12, "days": 5, "totalDays": 89, "dueDate": "2027-06-10"}},
{"name": "on the LMP itself with a 28-day cycle the gestational age is 0+0", "args": ["2026-03-15", "2026-03-15", 28], "expect": {"weeks": 0, "days": 0, "totalDays": 0, "dueDate": "2026-12-20"}},
{"name": "a pregnancy spanning 29 February 2028 counts the leap day", "args": ["2027-06-01", "2028-03-01", 28], "expect": {"weeks": 39, "days": 1, "totalDays": 274, "dueDate": "2028-03-07"}},
{"name": "44+0 weeks is still accepted", "args": ["2026-01-01", "2026-11-05", 28], "expect": {"weeks": 44, "days": 0, "totalDays": 308, "dueDate": "2026-10-08"}},
{"name": "44+1 weeks is an error: check the dates", "args": ["2026-01-01", "2026-11-06", 28], "expectError": "more than 44+0 weeks"},
{"name": "a 35-day cycle puts the adjusted start 7 days after the LMP, so 3 days after the LMP is an error", "args": ["2026-03-15", "2026-03-18", 35], "expectError": "is before the adjusted start of pregnancy"},
{"name": "onDate before the LMP is an error", "args": ["2026-03-15", "2026-03-14", 28], "expectError": "is before the adjusted start of pregnancy"},
{"name": "a 19-day cycle is outside the NHS calculator's 20 to 44 days", "args": ["2026-03-15", "2026-06-10", 19], "expectError": "cycleLengthDays must be a whole number from 20 to 44"},
{"name": "a 45-day cycle is outside 20 to 44 days", "args": ["2026-03-15", "2026-06-10", 45], "expectError": "cycleLengthDays must be a whole number from 20 to 44"},
{"name": "a fractional cycle length is an error", "args": ["2026-03-15", "2026-06-10", 28.5], "expectError": "cycleLengthDays must be a whole number from 20 to 44"},
{"name": "an impossible LMP date is an error", "args": ["2026-02-30", "2026-06-10", 28], "expectError": "is not a real calendar date"}
]