All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 50s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
20 lines
850 B
TypeScript
20 lines
850 B
TypeScript
import "../setup.ts";
|
|
import { assert, assertEquals, assertFalse } from "@std/assert";
|
|
import { makeSlug, slugify, UUID_RE } from "../../lib/slugify.ts";
|
|
|
|
Deno.test("slugify: lowercases, strips accents, dashes the rest", () => {
|
|
assertEquals(slugify("Hello, World!"), "hello-world");
|
|
assertEquals(slugify("Crème brûlée à Paris"), "creme-brulee-a-paris");
|
|
assertEquals(slugify(" --already--dashed-- "), "already-dashed");
|
|
assertEquals(slugify("日本語"), "untitled");
|
|
assertEquals(slugify(""), "untitled");
|
|
assertEquals(slugify("x".repeat(100)).length, 60);
|
|
});
|
|
|
|
Deno.test("makeSlug: suffixes the first 8 characters of the id", () => {
|
|
const id = "0123abcd-0000-4000-8000-000000000000";
|
|
assertEquals(makeSlug("My Song", id), "my-song-0123abcd");
|
|
assert(UUID_RE.test(id));
|
|
assertFalse(UUID_RE.test("my-song-0123abcd"));
|
|
});
|