Functional Weave
Code in TypeScript

construction.payment-notice-dates@1.0.1

vectors.json

6,730 bytes · view raw

[
  {
    "name": "interim payment: 7 days after the period, then 5, 17 and 7 days back",
    "args": [
      "interim",
      "2026-01-31",
      "2026-01-31",
      "2025-06-01",
      "england-and-wales"
    ],
    "expect": {
      "dueDate": "2026-02-07",
      "paymentNoticeBy": "2026-02-12",
      "finalDateForPayment": "2026-02-24",
      "payLessNoticeBy": "2026-02-17"
    }
  },
  {
    "name": "a claim made after the 7 days sets the due date",
    "args": [
      "interim",
      "2026-01-31",
      "2026-02-20",
      "2025-06-01",
      "england-and-wales"
    ],
    "expect": {
      "dueDate": "2026-02-20",
      "paymentNoticeBy": "2026-02-25",
      "finalDateForPayment": "2026-03-09",
      "payLessNoticeBy": "2026-03-02"
    }
  },
  {
    "name": "a claim made before the period ends does not bring the due date forward",
    "args": [
      "interim",
      "2026-02-28",
      "2026-02-10",
      "2025-06-01",
      "england-and-wales"
    ],
    "expect": {
      "dueDate": "2026-03-07",
      "paymentNoticeBy": "2026-03-12",
      "finalDateForPayment": "2026-03-24",
      "payLessNoticeBy": "2026-03-17"
    }
  },
  {
    "name": "weekends count: a Saturday due date is not moved",
    "args": [
      "interim",
      "2026-01-31",
      "2026-01-31",
      "2011-10-01",
      "england-and-wales"
    ],
    "expect": {
      "dueDate": "2026-02-07",
      "paymentNoticeBy": "2026-02-12",
      "finalDateForPayment": "2026-02-24",
      "payLessNoticeBy": "2026-02-17"
    }
  },
  {
    "name": "Easter in England: Good Friday and Easter Monday are not counted",
    "args": [
      "interim",
      "2026-03-31",
      "2026-03-31",
      "2025-06-01",
      "england-and-wales"
    ],
    "expect": {
      "dueDate": "2026-04-09",
      "paymentNoticeBy": "2026-04-14",
      "finalDateForPayment": "2026-04-26",
      "payLessNoticeBy": "2026-04-19"
    }
  },
  {
    "name": "Easter in Scotland: Good Friday is excluded but Easter Monday is not a Scottish bank holiday",
    "args": [
      "interim",
      "2026-03-31",
      "2026-03-31",
      "2025-06-01",
      "scotland"
    ],
    "expect": {
      "dueDate": "2026-04-08",
      "paymentNoticeBy": "2026-04-13",
      "finalDateForPayment": "2026-04-25",
      "payLessNoticeBy": "2026-04-18"
    }
  },
  {
    "name": "Christmas in England: Saturday 26 December is a statutory bank holiday as well as the Monday substitute",
    "args": [
      "interim",
      "2026-12-18",
      "2026-12-18",
      "2025-06-01",
      "england-and-wales"
    ],
    "expect": {
      "dueDate": "2026-12-27",
      "paymentNoticeBy": "2027-01-03",
      "finalDateForPayment": "2027-01-15",
      "payLessNoticeBy": "2027-01-08"
    }
  },
  {
    "name": "Christmas in Scotland: 26 December counts, Saturday 2 January does not",
    "args": [
      "interim",
      "2026-12-18",
      "2026-12-18",
      "2025-06-01",
      "scotland"
    ],
    "expect": {
      "dueDate": "2026-12-26",
      "paymentNoticeBy": "2027-01-03",
      "finalDateForPayment": "2027-01-16",
      "payLessNoticeBy": "2027-01-09"
    }
  },
  {
    "name": "final payment: 30 days after completion",
    "args": [
      "final",
      "2026-06-01",
      "2026-06-01",
      "2025-06-01",
      "england-and-wales"
    ],
    "expect": {
      "dueDate": "2026-07-01",
      "paymentNoticeBy": "2026-07-06",
      "finalDateForPayment": "2026-07-18",
      "payLessNoticeBy": "2026-07-11"
    }
  },
  {
    "name": "final payment claimed late",
    "args": [
      "final",
      "2026-06-01",
      "2026-08-10",
      "2025-06-01",
      "england-and-wales"
    ],
    "expect": {
      "dueDate": "2026-08-10",
      "paymentNoticeBy": "2026-08-15",
      "finalDateForPayment": "2026-08-27",
      "payLessNoticeBy": "2026-08-20"
    }
  },
  {
    "name": "other payment: 7 days after completion, across the May bank holidays",
    "args": [
      "other",
      "2026-05-01",
      "2026-05-01",
      "2025-06-01",
      "england-and-wales"
    ],
    "expect": {
      "dueDate": "2026-05-09",
      "paymentNoticeBy": "2026-05-14",
      "finalDateForPayment": "2026-05-27",
      "payLessNoticeBy": "2026-05-19"
    }
  },
  {
    "name": "a contract from before the 2011 amendments is not covered",
    "args": [
      "interim",
      "2026-01-31",
      "2026-01-31",
      "2011-09-30",
      "england-and-wales"
    ],
    "expectError": "no Scheme for Construction Contracts periods"
  },
  {
    "name": "the Scottish amendments start on 1 November 2011",
    "args": [
      "interim",
      "2026-01-31",
      "2026-01-31",
      "2011-10-15",
      "scotland"
    ],
    "expectError": "no Scheme for Construction Contracts periods"
  },
  {
    "name": "Northern Ireland has its own Order and is not covered",
    "args": [
      "interim",
      "2026-01-31",
      "2026-01-31",
      "2025-06-01",
      "northern-ireland"
    ],
    "expectError": "no Scheme for Construction Contracts periods"
  },
  {
    "name": "an unknown payment kind",
    "args": [
      "weekly",
      "2026-01-31",
      "2026-01-31",
      "2025-06-01",
      "england-and-wales"
    ],
    "expectError": "no Scheme for Construction Contracts periods"
  },
  {
    "name": "a period running into a year without bank holiday data",
    "args": [
      "interim",
      "2028-12-20",
      "2028-12-20",
      "2025-06-01",
      "england-and-wales"
    ],
    "expectError": "no bank holiday data"
  },
  {
    "name": "a malformed date",
    "args": [
      "interim",
      "2026/01/31",
      "2026-01-31",
      "2025-06-01",
      "england-and-wales"
    ],
    "expectError": "workDate must be an ISO date"
  },
  {
    "name": "a trailing newline after workDate is not an ISO date",
    "args": [
      "interim",
      "2026-09-16\n",
      "2026-01-31",
      "2025-06-01",
      "england-and-wales"
    ],
    "expectError": "workDate must be an ISO date"
  },
  {
    "name": "Arabic-Indic digits in workDate are not an ISO date",
    "args": [
      "interim",
      "٢٠٢٦-09-16",
      "2026-01-31",
      "2025-06-01",
      "england-and-wales"
    ],
    "expectError": "workDate must be an ISO date"
  },
  {
    "name": "a trailing newline after claimDate is not an ISO date",
    "args": [
      "interim",
      "2026-01-31",
      "2026-01-31\n",
      "2025-06-01",
      "england-and-wales"
    ],
    "expectError": "claimDate must be an ISO date"
  },
  {
    "name": "a trailing newline after contractDate is not an ISO date",
    "args": [
      "interim",
      "2026-01-31",
      "2026-01-31",
      "2025-06-01\n",
      "england-and-wales"
    ],
    "expectError": "contractDate must be an ISO date"
  }
]