- Run tests for all 10 services via per-service pytest subprocesses - Group results by service with section headers - Clickable summary cards filter by outcome (passed/failed/errors/skipped) - Service filter nav using ~nav-link buttons in menu bar - Full menu integration: ~header-row + ~header-child + ~menu-row - Show logo image via cart-mini rendering - Mount full service directories in docker-compose for test access - Add 24 unit test files across 9 services Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
46 lines
1.5 KiB
Python
46 lines
1.5 KiB
Python
"""Unit tests for market slug helpers."""
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
from market.bp.browse.services.slugs import (
|
|
product_slug_from_href, canonical_html_slug,
|
|
)
|
|
|
|
|
|
class TestProductSlugFromHref:
|
|
def test_html_extension(self):
|
|
result = product_slug_from_href("https://site.com/foo/bar-thing.html")
|
|
assert result == "bar-thing-html"
|
|
|
|
def test_htm_extension(self):
|
|
result = product_slug_from_href("https://site.com/products/widget.htm")
|
|
assert result == "widget-html"
|
|
|
|
def test_no_extension(self):
|
|
result = product_slug_from_href("https://site.com/item/cool-product")
|
|
assert result == "cool-product-html"
|
|
|
|
def test_empty_path(self):
|
|
result = product_slug_from_href("https://site.com/")
|
|
assert result == ""
|
|
|
|
def test_already_has_html_suffix_in_slug(self):
|
|
result = product_slug_from_href("https://site.com/prod/item-html.html")
|
|
assert result == "item-html"
|
|
|
|
|
|
class TestCanonicalHtmlSlug:
|
|
def test_adds_html_suffix(self):
|
|
assert canonical_html_slug("product-name") == "product-name-html"
|
|
|
|
def test_idempotent(self):
|
|
assert canonical_html_slug("product-name-html") == "product-name-html"
|
|
|
|
def test_double_html_kept(self):
|
|
# canonical_html_slug only appends -html if not already present
|
|
assert canonical_html_slug("product-name-html-html") == "product-name-html-html"
|
|
|
|
def test_strips_htm(self):
|
|
assert canonical_html_slug("product-name-htm") == "product-name-html"
|