mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-13 11:00:50 +00:00
refactor(shared): centralize @/# slug normalization
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
normalizeAtHashSlug,
|
||||
normalizeHyphenSlug,
|
||||
normalizeStringEntries,
|
||||
normalizeStringEntriesLower,
|
||||
@@ -22,4 +23,11 @@ describe("shared/string-normalization", () => {
|
||||
expect(normalizeHyphenSlug(undefined)).toBe("");
|
||||
expect(normalizeHyphenSlug(null)).toBe("");
|
||||
});
|
||||
|
||||
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("");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user