afp-backend / tests /unit /test_brand_normalization.py
Cyril Dupland
feat: implement brand and category slug normalization, update import mappings, and enhance article import processing
1cc158b
Raw
History Blame Contribute Delete
678 Bytes
import pytest
from app.domain.brand_normalization import normalize_brand_slug
@pytest.mark.unit
def test_normalize_brand_slug_replaces_spaces_and_punctuation() -> None:
assert normalize_brand_slug(" Acme Corp ") == "acme-corp"
assert normalize_brand_slug("Foo.Bar,Baz") == "foo-bar-baz"
assert normalize_brand_slug("already-slug") == "already-slug"
assert normalize_brand_slug("a -- b") == "a-b"
@pytest.mark.unit
def test_normalize_brand_slug_empty_to_none() -> None:
assert normalize_brand_slug("") is None
assert normalize_brand_slug(" ") is None
assert normalize_brand_slug("...") is None
assert normalize_brand_slug(None) is None