Skip to content

Commit

Permalink
Ensure building name containing single character exception is still
Browse files Browse the repository at this point in the history
handled correctly
  • Loading branch information
cblanc committed Dec 14, 2023
1 parent 7d487e7 commit 15ddc02
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/data/formatting.json
Original file line number Diff line number Diff line change
Expand Up @@ -1251,6 +1251,27 @@
},
"description": "Rule 2: Exception"
},
{
"expected": {
"line_1": "Flat 401",
"line_2": "Wallscourt Park Residences",
"line_3": "E Coldharbour Lane",
"post_town": "BRISTOL",
"postcode": "BS16 1ZX",
"number": "E",
"unit": "Flat 401",
"premise": "Flat 401, Wallscourt Park Residences, E"
},
"fixture": {
"post_town": "BRISTOL",
"thoroughfare": "Coldharbour Lane",
"postcode": "BS16 1ZX",
"building_number": "",
"building_name": "Wallscourt Park Residences E",
"sub_building_name": "Flat 401"
},
"description": "Regression: Improperly breaking building name"
},
{
"expected": {
"line_1": "Flat 401",
Expand Down
17 changes: 17 additions & 0 deletions test/rules.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,23 @@ describe("Rules", () => {
line_3: "",
});
});

it("handles sub range match", () => {
const base = new Address({
thoroughfare: "High Street",
building_name: "Foo A",
});

assert.deepEqual(rule3(base), {
premise: "Foo, A",
unit: "",
number: "A",
line_1: "Foo",
line_2: "A High Street",
line_3: "",
});
});

it("handles sub range match", () => {
const base = new Address({
thoroughfare: "High Street",
Expand Down

0 comments on commit 15ddc02

Please sign in to comment.