Files
outline/shared/utils/slugify.test.ts
T
Tom Moor a004b24e83 chore: Upgrade slug from 5 to 11 (#14038)
* chore: Upgrade slug from 5 to 11

* Require Node 22.12+ for require(esm), test θ transliteration

* Polyfill String isWellFormed and toWellFormed for older browsers
2026-10-11 16:13:48 -04:00

27 lines
781 B
TypeScript

import slugify from "./slugify";
describe("slugify", () => {
it("should convert text to a kebab-case slug", () => {
expect(slugify("Hello World")).toBe("hello-world");
});
it("should remove periods", () => {
expect(slugify("Release v1.2.3")).toBe("release-v123");
});
it("should transliterate non-latin characters", () => {
expect(slugify("Café résumé")).toBe("cafe-resume");
expect(slugify("Привет мир")).toBe("privet-mir");
expect(slugify("θεός")).toBe("theos");
});
it("should keep surrogate pairs", () => {
expect(slugify("emoji 🎉 test")).toBe("emoji-test");
});
it("should not throw on lone surrogates", () => {
expect(slugify("x\uD800y")).toBe("xy");
expect(slugify("x\uDC00y")).toBe("xy");
});
});