Functional Weave
Code in Python

charity.higher-rate-relief@1.0.0

vectors.json

6,723 bytes · view raw

[
  {"name": "higher rate taxpayer, £800 given: £1,000 gross, the donor saves another £200", "args": [{"minor": 6000000, "currency": "GBP"}, {"minor": 80000, "currency": "GBP"}, "rest-of-uk", "2026-06-01"], "expect": {"grossDonations": {"minor": 100000, "currency": "GBP"}, "basicRateRelief": {"minor": 20000, "currency": "GBP"}, "taxBefore": {"minor": 1646000, "currency": "GBP"}, "taxAfter": {"minor": 1626000, "currency": "GBP"}, "extraRelief": {"minor": 20000, "currency": "GBP"}, "netCost": {"minor": 60000, "currency": "GBP"}}},
  {"name": "income just £300 into the higher band: only £300 moves, relief £60 not £200", "args": [{"minor": 3800000, "currency": "GBP"}, {"minor": 80000, "currency": "GBP"}, "rest-of-uk", "2026-06-01"], "expect": {"grossDonations": {"minor": 100000, "currency": "GBP"}, "basicRateRelief": {"minor": 20000, "currency": "GBP"}, "taxBefore": {"minor": 766000, "currency": "GBP"}, "taxAfter": {"minor": 760000, "currency": "GBP"}, "extraRelief": {"minor": 6000, "currency": "GBP"}, "netCost": {"minor": 74000, "currency": "GBP"}}},
  {"name": "additional rate taxpayer: the higher rate limit moves too, relief 25% of gross", "args": [{"minor": 15000000, "currency": "GBP"}, {"minor": 80000, "currency": "GBP"}, "rest-of-uk", "2026-06-01"], "expect": {"grossDonations": {"minor": 100000, "currency": "GBP"}, "basicRateRelief": {"minor": 20000, "currency": "GBP"}, "taxBefore": {"minor": 5370300, "currency": "GBP"}, "taxAfter": {"minor": 5345300, "currency": "GBP"}, "extraRelief": {"minor": 25000, "currency": "GBP"}, "netCost": {"minor": 55000, "currency": "GBP"}}},
  {"name": "basic rate taxpayer: no extra relief", "args": [{"minor": 2000000, "currency": "GBP"}, {"minor": 80000, "currency": "GBP"}, "rest-of-uk", "2026-06-01"], "expect": {"grossDonations": {"minor": 100000, "currency": "GBP"}, "basicRateRelief": {"minor": 20000, "currency": "GBP"}, "taxBefore": {"minor": 400000, "currency": "GBP"}, "taxAfter": {"minor": 400000, "currency": "GBP"}, "extraRelief": {"minor": 0, "currency": "GBP"}, "netCost": {"minor": 80000, "currency": "GBP"}}},
  {"name": "no taxable income: no tax, no extra relief", "args": [{"minor": 0, "currency": "GBP"}, {"minor": 80000, "currency": "GBP"}, "rest-of-uk", "2026-06-01"], "expect": {"grossDonations": {"minor": 100000, "currency": "GBP"}, "basicRateRelief": {"minor": 20000, "currency": "GBP"}, "taxBefore": {"minor": 0, "currency": "GBP"}, "taxAfter": {"minor": 0, "currency": "GBP"}, "extraRelief": {"minor": 0, "currency": "GBP"}, "netCost": {"minor": 80000, "currency": "GBP"}}},
  {"name": "£10.01 given: 20% of £12.51 is 250.2p, rounded down to 250p", "args": [{"minor": 6000000, "currency": "GBP"}, {"minor": 1001, "currency": "GBP"}, "rest-of-uk", "2026-06-01"], "expect": {"grossDonations": {"minor": 1251, "currency": "GBP"}, "basicRateRelief": {"minor": 250, "currency": "GBP"}, "taxBefore": {"minor": 1646000, "currency": "GBP"}, "taxAfter": {"minor": 1645750, "currency": "GBP"}, "extraRelief": {"minor": 250, "currency": "GBP"}, "netCost": {"minor": 751, "currency": "GBP"}}},
  {"name": "Scottish higher rate taxpayer 2026-27: 42% less 20%, relief £220 on £1,000 gross", "args": [{"minor": 4000000, "currency": "GBP"}, {"minor": 80000, "currency": "GBP"}, "scotland", "2026-06-01"], "expect": {"grossDonations": {"minor": 100000, "currency": "GBP"}, "basicRateRelief": {"minor": 20000, "currency": "GBP"}, "taxBefore": {"minor": 1006145, "currency": "GBP"}, "taxAfter": {"minor": 984145, "currency": "GBP"}, "extraRelief": {"minor": 22000, "currency": "GBP"}, "netCost": {"minor": 58000, "currency": "GBP"}}},
  {"name": "Scottish intermediate rate taxpayer: relief 1%, the starter band is not extended", "args": [{"minor": 2000000, "currency": "GBP"}, {"minor": 80000, "currency": "GBP"}, "scotland", "2026-06-01"], "expect": {"grossDonations": {"minor": 100000, "currency": "GBP"}, "basicRateRelief": {"minor": 20000, "currency": "GBP"}, "taxBefore": {"minor": 399077, "currency": "GBP"}, "taxAfter": {"minor": 398077, "currency": "GBP"}, "extraRelief": {"minor": 1000, "currency": "GBP"}, "netCost": {"minor": 79000, "currency": "GBP"}}},
  {"name": "Scottish top rate taxpayer 2023-24: the top rate threshold moves as well, 27% relief", "args": [{"minor": 13000000, "currency": "GBP"}, {"minor": 80000, "currency": "GBP"}, "scotland", "2023-12-01"], "expect": {"grossDonations": {"minor": 100000, "currency": "GBP"}, "basicRateRelief": {"minor": 20000, "currency": "GBP"}, "taxBefore": {"minor": 4816088, "currency": "GBP"}, "taxAfter": {"minor": 4789088, "currency": "GBP"}, "extraRelief": {"minor": 27000, "currency": "GBP"}, "netCost": {"minor": 53000, "currency": "GBP"}}},
  {"name": "a Welsh taxpayer uses the UK limits", "args": [{"minor": 6000000, "currency": "GBP"}, {"minor": 80000, "currency": "GBP"}, "wales", "2024-06-01"], "expect": {"grossDonations": {"minor": 100000, "currency": "GBP"}, "basicRateRelief": {"minor": 20000, "currency": "GBP"}, "taxBefore": {"minor": 1646000, "currency": "GBP"}, "taxAfter": {"minor": 1626000, "currency": "GBP"}, "extraRelief": {"minor": 20000, "currency": "GBP"}, "netCost": {"minor": 60000, "currency": "GBP"}}},
  {"name": "no donations: nothing changes", "args": [{"minor": 6000000, "currency": "GBP"}, {"minor": 0, "currency": "GBP"}, "rest-of-uk", "2026-06-01"], "expect": {"grossDonations": {"minor": 0, "currency": "GBP"}, "basicRateRelief": {"minor": 0, "currency": "GBP"}, "taxBefore": {"minor": 1646000, "currency": "GBP"}, "taxAfter": {"minor": 1646000, "currency": "GBP"}, "extraRelief": {"minor": 0, "currency": "GBP"}, "netCost": {"minor": 0, "currency": "GBP"}}},
  {"name": "a tax year before the bands on file is an error", "args": [{"minor": 6000000, "currency": "GBP"}, {"minor": 80000, "currency": "GBP"}, "rest-of-uk", "2022-06-01"], "expectError": "no income tax bands for rest-of-uk on 2022-06-01"},
  {"name": "an unknown region is an error", "args": [{"minor": 6000000, "currency": "GBP"}, {"minor": 80000, "currency": "GBP"}, "england", "2026-06-01"], "expectError": "unknown tax region \"england\""},
  {"name": "negative taxable income is an error", "args": [{"minor": -1, "currency": "GBP"}, {"minor": 80000, "currency": "GBP"}, "rest-of-uk", "2026-06-01"], "expectError": "taxableIncome must not be negative"},
  {"name": "taxable income in euros is an error", "args": [{"minor": 6000000, "currency": "EUR"}, {"minor": 80000, "currency": "GBP"}, "rest-of-uk", "2026-06-01"], "expectError": "taxableIncome must be in GBP"},
  {"name": "negative donations are an error", "args": [{"minor": 6000000, "currency": "GBP"}, {"minor": -100, "currency": "GBP"}, "rest-of-uk", "2026-06-01"], "expectError": "donation must not be negative"}
]