test: tighten shared text normalization coverage

This commit is contained in:
Peter Steinberger
2026-03-13 21:26:15 +00:00
parent 0c79c86b40
commit 090c0c4b5d
2 changed files with 23 additions and 0 deletions

View File

@@ -29,10 +29,20 @@ describe("shared/string-normalization", () => {
expect(normalizeHyphenSlug(null)).toBe("");
});
it("collapses repeated separators and trims leading/trailing punctuation", () => {
expect(normalizeHyphenSlug(" ...Hello / World--- ")).toBe("hello-world");
expect(normalizeHyphenSlug(" ###Team@@@Room### ")).toBe("###team@@@room###");
});
it("normalizes @/# prefixed slugs used by channel allowlists", () => {
expect(normalizeAtHashSlug(" #My_Channel + Alerts ")).toBe("my-channel-alerts");
expect(normalizeAtHashSlug("@@Room___Name")).toBe("room-name");
expect(normalizeAtHashSlug(undefined)).toBe("");
expect(normalizeAtHashSlug(null)).toBe("");
});
it("strips repeated prefixes and collapses separator-only results", () => {
expect(normalizeAtHashSlug("###__Room Name__")).toBe("room-name");
expect(normalizeAtHashSlug("@@@___")).toBe("");
});
});