Files
pkm/tests/test_slugs.py
2025-08-18 20:14:56 +02:00

20 lines
532 B
Python

from app.utils.slugs import slugify
def test_slugify_basic():
assert slugify("Hello World") == "hello-world"
assert slugify("Hello World!!!") == "hello-world"
assert slugify("Café au lait") == "cafe-au-lait"
assert slugify("123 Numbers First") == "123-numbers-first"
def test_slugify_length():
long = "A" * 200
s = slugify(long, max_length=32)
assert len(s) <= 32
assert s.startswith("a")
def test_slugify_empty():
assert slugify("") == "untitled"
assert slugify("!!!") == "untitled"