[
{
"name": "five days a week for a full leave year is exactly 28 days, not capped",
"args": [
{
"kind": "regular",
"daysPerWeekX100": 500,
"employmentStart": null,
"employmentEnd": null,
"minutesWorked": 0
},
"2025-01-01"
],
"expect": {
"kind": "regular",
"daysX100": 2800,
"capped": false,
"hoursAccrued": 0
}
},
{
"name": "six days a week would be 33.6 days: capped at 28",
"args": [
{
"kind": "regular",
"daysPerWeekX100": 600,
"employmentStart": null,
"employmentEnd": null,
"minutesWorked": 0
},
"2025-01-01"
],
"expect": {
"kind": "regular",
"daysX100": 2800,
"capped": true,
"hoursAccrued": 0
}
},
{
"name": "two and a half days a week is 14 days",
"args": [
{
"kind": "regular",
"daysPerWeekX100": 250,
"employmentStart": null,
"employmentEnd": null,
"minutesWorked": 0
},
"2025-01-01"
],
"expect": {
"kind": "regular",
"daysX100": 1400,
"capped": false,
"hoursAccrued": 0
}
},
{
"name": "three days a week is 16.8 days",
"args": [
{
"kind": "regular",
"daysPerWeekX100": 300,
"employmentStart": null,
"employmentEnd": null,
"minutesWorked": 0
},
"2025-01-01"
],
"expect": {
"kind": "regular",
"daysX100": 1680,
"capped": false,
"hoursAccrued": 0
}
},
{
"name": "four and a half days a week is 25.2 days",
"args": [
{
"kind": "regular",
"daysPerWeekX100": 450,
"employmentStart": null,
"employmentEnd": null,
"minutesWorked": 0
},
"2025-04-01"
],
"expect": {
"kind": "regular",
"daysX100": 2520,
"capped": false,
"hoursAccrued": 0
}
},
{
"name": "a starter on 13 January gets 353/365 of 28 days, rounded up to 27.08",
"args": [
{
"kind": "regular",
"daysPerWeekX100": 500,
"employmentStart": "2025-01-13",
"employmentEnd": null,
"minutesWorked": 0
},
"2025-01-01"
],
"expect": {
"kind": "regular",
"daysX100": 2708,
"capped": false,
"hoursAccrued": 0
}
},
{
"name": "a leaver on 30 September gets 183/365 of 28 days, rounded up to 14.04",
"args": [
{
"kind": "regular",
"daysPerWeekX100": 500,
"employmentStart": null,
"employmentEnd": "2025-09-30",
"minutesWorked": 0
},
"2025-04-01"
],
"expect": {
"kind": "regular",
"daysX100": 1404,
"capped": false,
"hoursAccrued": 0
}
},
{
"name": "a leap-year leave year has 366 days",
"args": [
{
"kind": "regular",
"daysPerWeekX100": 500,
"employmentStart": "2024-07-01",
"employmentEnd": null,
"minutesWorked": 0
},
"2024-01-01"
],
"expect": {
"kind": "regular",
"daysX100": 1408,
"capped": false,
"hoursAccrued": 0
}
},
{
"name": "starting and leaving in the same year: 92 days of 16.8",
"args": [
{
"kind": "regular",
"daysPerWeekX100": 300,
"employmentStart": "2025-03-01",
"employmentEnd": "2025-05-31",
"minutesWorked": 0
},
"2025-01-01"
],
"expect": {
"kind": "regular",
"daysX100": 424,
"capped": false,
"hoursAccrued": 0
}
},
{
"name": "a start date before the leave year counts from the leave year",
"args": [
{
"kind": "regular",
"daysPerWeekX100": 500,
"employmentStart": "2020-06-15",
"employmentEnd": null,
"minutesWorked": 0
},
"2025-01-01"
],
"expect": {
"kind": "regular",
"daysX100": 2800,
"capped": false,
"hoursAccrued": 0
}
},
{
"name": "30 hours worked accrues 3.621 hours: rounds to 4",
"args": [
{
"kind": "irregular-hours",
"daysPerWeekX100": 0,
"employmentStart": null,
"employmentEnd": null,
"minutesWorked": 1800
},
"2024-04-01"
],
"expect": {
"kind": "irregular-hours",
"daysX100": 0,
"capped": false,
"hoursAccrued": 4
}
},
{
"name": "20 hours worked accrues 2.414 hours: rounds to 2",
"args": [
{
"kind": "irregular-hours",
"daysPerWeekX100": 0,
"employmentStart": null,
"employmentEnd": null,
"minutesWorked": 1200
},
"2025-01-01"
],
"expect": {
"kind": "irregular-hours",
"daysX100": 0,
"capped": false,
"hoursAccrued": 2
}
},
{
"name": "a part-year worker accrues the same way",
"args": [
{
"kind": "part-year",
"daysPerWeekX100": 0,
"employmentStart": null,
"employmentEnd": null,
"minutesWorked": 1500
},
"2025-09-01"
],
"expect": {
"kind": "part-year",
"daysX100": 0,
"capped": false,
"hoursAccrued": 3
}
},
{
"name": "exactly half an hour over rounds up",
"args": [
{
"kind": "irregular-hours",
"daysPerWeekX100": 0,
"employmentStart": null,
"employmentEnd": null,
"minutesWorked": 300000
},
"2025-01-01"
],
"expect": {
"kind": "irregular-hours",
"daysX100": 0,
"capped": false,
"hoursAccrued": 604
}
},
{
"name": "just under half an hour over rounds down",
"args": [
{
"kind": "irregular-hours",
"daysPerWeekX100": 0,
"employmentStart": null,
"employmentEnd": null,
"minutesWorked": 299999
},
"2025-01-01"
],
"expect": {
"kind": "irregular-hours",
"daysX100": 0,
"capped": false,
"hoursAccrued": 603
}
},
{
"name": "no hours worked accrues nothing",
"args": [
{
"kind": "irregular-hours",
"daysPerWeekX100": 0,
"employmentStart": null,
"employmentEnd": null,
"minutesWorked": 0
},
"2025-01-01"
],
"expect": {
"kind": "irregular-hours",
"daysX100": 0,
"capped": false,
"hoursAccrued": 0
}
},
{
"name": "12.07% accrual does not apply to a leave year that began before 1 April 2024",
"args": [
{
"kind": "irregular-hours",
"daysPerWeekX100": 0,
"employmentStart": null,
"employmentEnd": null,
"minutesWorked": 1800
},
"2024-03-31"
],
"expectError": "no holiday 12.07% accrual rule for a leave year beginning 2024-03-31"
},
{
"name": "zero days a week is an error",
"args": [
{
"kind": "regular",
"daysPerWeekX100": 0,
"employmentStart": null,
"employmentEnd": null,
"minutesWorked": 0
},
"2025-01-01"
],
"expectError": "daysPerWeekX100 must be 1 to 700"
},
{
"name": "more than seven days a week is an error",
"args": [
{
"kind": "regular",
"daysPerWeekX100": 800,
"employmentStart": null,
"employmentEnd": null,
"minutesWorked": 0
},
"2025-01-01"
],
"expectError": "daysPerWeekX100 must be 1 to 700"
},
{
"name": "employment outside the leave year is an error",
"args": [
{
"kind": "regular",
"daysPerWeekX100": 500,
"employmentStart": "2026-02-01",
"employmentEnd": null,
"minutesWorked": 0
},
"2025-01-01"
],
"expectError": "does not overlap the leave year"
},
{
"name": "negative minutes are an error",
"args": [
{
"kind": "irregular-hours",
"daysPerWeekX100": 0,
"employmentStart": null,
"employmentEnd": null,
"minutesWorked": -60
},
"2025-01-01"
],
"expectError": "minutesWorked must be a whole number of minutes"
},
{
"name": "a malformed leave-year date is an error",
"args": [
{
"kind": "regular",
"daysPerWeekX100": 500,
"employmentStart": null,
"employmentEnd": null,
"minutesWorked": 0
},
"2025-13-01"
],
"expectError": "is not a real calendar date"
}
]