From ab891134895435ff638895fcc08fbceaf1c7c0c1 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 8 Oct 2026 19:06:30 +0200 Subject: [PATCH] Test: a site typed without its space is deliberately NOT folded MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PHI 180 prints "Westpark" where the register says "West Park", so a spacing-insensitive fold looks like an obvious typo fix. Tried it, and it is wrong: the register ALSO carries both "Autumns Gate" and "Autumnsgate", and no rule can tell a missing space from two genuinely different places — it merged that pair. Reverted lib/sites.ts to its previous conservative behaviour and pinned the decision with a test. PHI 180's stored name was corrected to "West Park" by hand instead. Merging the two Autumn sites is the client's call, not a side effect of a re-import. --- lib/invoice-parser.test.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/invoice-parser.test.ts b/lib/invoice-parser.test.ts index 9430508..5aeab40 100644 --- a/lib/invoice-parser.test.ts +++ b/lib/invoice-parser.test.ts @@ -280,3 +280,17 @@ test("folding never invents a site or splits a different one", () => { assert.equal(resolveSiteName("Cosmo City Extension", known), "Cosmo City Extension"); assert.equal(resolveSiteName("Cosmo City North", known), "Cosmo City North"); }); + +test("a site typed without its space is NOT folded — that would merge two real sites", () => { + // PHI 180 prints "Westpark" where the register says "West Park", so this looks like a + // spacing typo worth folding. It is deliberately left alone: the register ALSO carries + // both "Autumns Gate" and "Autumnsgate", and a spacing-insensitive rule cannot tell a + // typo from two genuinely different places — it would silently merge that pair. + // + // PHI 180's stored name was corrected to "West Park" by hand instead. Merging the two + // Autumn sites is the client's call, not a side effect of a re-import. + const known = ["West Park", "Autumns Gate", "Autumnsgate"]; + assert.equal(resolveSiteName("Westpark", known), "Westpark"); + assert.equal(resolveSiteName("Autumnsgate", known), "Autumnsgate"); + assert.equal(resolveSiteName("Autumns Gate", known), "Autumns Gate"); +});