mirror of
https://github.com/outline/outline.git
synced 2026-11-22 05:51:43 +03:00
* chore: Upgrade slug from 5 to 11 * Require Node 22.12+ for require(esm), test θ transliteration * Polyfill String isWellFormed and toWellFormed for older browsers
27 lines
781 B
TypeScript
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");
|
|
});
|
|
});
|