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"); +});