[
{
"name": "the standard personal allowance code",
"args": [
"1257L"
],
"expect": {
"code": "1257L",
"region": "rest-of-uk",
"kind": "allowance",
"number": 1257,
"suffix": "L",
"annualAllowance": {
"minor": 1257900,
"currency": "GBP"
},
"cumulative": true
}
},
{
"name": "a Scottish taxpayer",
"args": [
"S1257L"
],
"expect": {
"code": "S1257L",
"region": "scotland",
"kind": "allowance",
"number": 1257,
"suffix": "L",
"annualAllowance": {
"minor": 1257900,
"currency": "GBP"
},
"cumulative": true
}
},
{
"name": "a Welsh taxpayer",
"args": [
"C1257L"
],
"expect": {
"code": "C1257L",
"region": "wales",
"kind": "allowance",
"number": 1257,
"suffix": "L",
"annualAllowance": {
"minor": 1257900,
"currency": "GBP"
},
"cumulative": true
}
},
{
"name": "lower case and stray spaces are tidied",
"args": [
" s1257l "
],
"expect": {
"code": "S1257L",
"region": "scotland",
"kind": "allowance",
"number": 1257,
"suffix": "L",
"annualAllowance": {
"minor": 1257900,
"currency": "GBP"
},
"cumulative": true
}
},
{
"name": "emergency code on a week 1 basis, with a space",
"args": [
"1257L W1"
],
"expect": {
"code": "1257L",
"region": "rest-of-uk",
"kind": "allowance",
"number": 1257,
"suffix": "L",
"annualAllowance": {
"minor": 1257900,
"currency": "GBP"
},
"cumulative": false
}
},
{
"name": "month 1 basis written without a space",
"args": [
"1257LM1"
],
"expect": {
"code": "1257L",
"region": "rest-of-uk",
"kind": "allowance",
"number": 1257,
"suffix": "L",
"annualAllowance": {
"minor": 1257900,
"currency": "GBP"
},
"cumulative": false
}
},
{
"name": "the X marker is also non-cumulative",
"args": [
"1257L X"
],
"expect": {
"code": "1257L",
"region": "rest-of-uk",
"kind": "allowance",
"number": 1257,
"suffix": "L",
"annualAllowance": {
"minor": 1257900,
"currency": "GBP"
},
"cumulative": false
}
},
{
"name": "marriage allowance recipient suffix M",
"args": [
"1383M"
],
"expect": {
"code": "1383M",
"region": "rest-of-uk",
"kind": "allowance",
"number": 1383,
"suffix": "M",
"annualAllowance": {
"minor": 1383900,
"currency": "GBP"
},
"cumulative": true
}
},
{
"name": "0T is no allowance at all, not 9 pounds",
"args": [
"0T"
],
"expect": {
"code": "0T",
"region": "rest-of-uk",
"kind": "allowance",
"number": 0,
"suffix": "T",
"annualAllowance": {
"minor": 0,
"currency": "GBP"
},
"cumulative": true
}
},
{
"name": "code 1 is worth 19 pounds",
"args": [
"1L"
],
"expect": {
"code": "1L",
"region": "rest-of-uk",
"kind": "allowance",
"number": 1,
"suffix": "L",
"annualAllowance": {
"minor": 1900,
"currency": "GBP"
},
"cumulative": true
}
},
{
"name": "a K code is a negative allowance",
"args": [
"K475"
],
"expect": {
"code": "K475",
"region": "rest-of-uk",
"kind": "negative-allowance",
"number": 475,
"suffix": null,
"annualAllowance": {
"minor": -475900,
"currency": "GBP"
},
"cumulative": true
}
},
{
"name": "a Scottish K code on a month 1 basis",
"args": [
"SK475 M1"
],
"expect": {
"code": "SK475",
"region": "scotland",
"kind": "negative-allowance",
"number": 475,
"suffix": null,
"annualAllowance": {
"minor": -475900,
"currency": "GBP"
},
"cumulative": false
}
},
{
"name": "BR taxes everything at the basic rate",
"args": [
"BR"
],
"expect": {
"code": "BR",
"region": "rest-of-uk",
"kind": "basic-rate",
"number": 0,
"suffix": null,
"annualAllowance": {
"minor": 0,
"currency": "GBP"
},
"cumulative": true
}
},
{
"name": "Welsh BR on a week 1 basis",
"args": [
"CBR W1"
],
"expect": {
"code": "CBR",
"region": "wales",
"kind": "basic-rate",
"number": 0,
"suffix": null,
"annualAllowance": {
"minor": 0,
"currency": "GBP"
},
"cumulative": false
}
},
{
"name": "D0 is the higher rate on everything",
"args": [
"D0"
],
"expect": {
"code": "D0",
"region": "rest-of-uk",
"kind": "d-rate",
"number": 0,
"suffix": null,
"annualAllowance": {
"minor": 0,
"currency": "GBP"
},
"cumulative": true
}
},
{
"name": "SD2 is Scotland's advanced rate on everything",
"args": [
"SD2"
],
"expect": {
"code": "SD2",
"region": "scotland",
"kind": "d-rate",
"number": 2,
"suffix": null,
"annualAllowance": {
"minor": 0,
"currency": "GBP"
},
"cumulative": true
}
},
{
"name": "NT means no tax",
"args": [
"NT"
],
"expect": {
"code": "NT",
"region": "rest-of-uk",
"kind": "no-tax",
"number": 0,
"suffix": null,
"annualAllowance": {
"minor": 0,
"currency": "GBP"
},
"cumulative": true
}
},
{
"name": "a six-digit code",
"args": [
"999999T"
],
"expect": {
"code": "999999T",
"region": "rest-of-uk",
"kind": "allowance",
"number": 999999,
"suffix": "T",
"annualAllowance": {
"minor": 999999900,
"currency": "GBP"
},
"cumulative": true
}
},
{
"name": "there is no Scottish NT",
"args": [
"SNT"
],
"expectError": "there is no Scottish or Welsh NT code"
},
{
"name": "there is no K0",
"args": [
"K0"
],
"expectError": "unrecognised tax code"
},
{
"name": "a withdrawn suffix is refused",
"args": [
"1257P"
],
"expectError": "unrecognised tax code"
},
{
"name": "a number without a suffix is refused",
"args": [
"1257"
],
"expectError": "unrecognised tax code"
},
{
"name": "0L is not issued",
"args": [
"0L"
],
"expectError": "only issued as 0T"
},
{
"name": "leading zeros are refused",
"args": [
"01257L"
],
"expectError": "unrecognised tax code"
},
{
"name": "an empty code is refused",
"args": [
" "
],
"expectError": "unrecognised tax code"
},
{
"name": "a basis marker on its own is not a code",
"args": [
"W1"
],
"expectError": "unrecognised tax code"
},
{
"name": "a trailing newline is trimmed like any other space",
"args": [
"1257L\n"
],
"expect": {
"code": "1257L",
"region": "rest-of-uk",
"kind": "allowance",
"number": 1257,
"suffix": "L",
"annualAllowance": {
"minor": 1257900,
"currency": "GBP"
},
"cumulative": true
}
},
{
"name": "a newline before the basis marker is a space",
"args": [
"1257L\nW1"
],
"expect": {
"code": "1257L",
"region": "rest-of-uk",
"kind": "allowance",
"number": 1257,
"suffix": "L",
"annualAllowance": {
"minor": 1257900,
"currency": "GBP"
},
"cumulative": false
}
},
{
"name": "a no-break space is trimmed in every language",
"args": [
"1257L\u00a0"
],
"expect": {
"code": "1257L",
"region": "rest-of-uk",
"kind": "allowance",
"number": 1257,
"suffix": "L",
"annualAllowance": {
"minor": 1257900,
"currency": "GBP"
},
"cumulative": true
}
},
{
"name": "a next-line control (U+0085) is not trimmed, so the code is refused",
"args": [
"1257L\u0085"
],
"expectError": "unrecognised tax code"
},
{
"name": "a unit separator (U+001F) is not trimmed, so the code is refused",
"args": [
"1257L\u001f"
],
"expectError": "unrecognised tax code"
},
{
"name": "a byte order mark (U+FEFF) is not trimmed, so the code is refused",
"args": [
"\ufeff1257L"
],
"expectError": "unrecognised tax code"
}
]