"""Regex-only classification of product-detail URLs -- the free path that
covers Shopify/WooCommerce/Magento-style conventions before the LLM
fallback (see PRODUCT_LINK_CLASSIFICATION_PROMPT) ever runs."""
from app.services.content.website import _looks_like_product_url


def test_shopify_style_plural_products_path():
    assert _looks_like_product_url("https://shop.example.com/products/oxford-shirt")


def test_woocommerce_style_singular_product_path():
    assert _looks_like_product_url("https://shop.example.com/product/oxford-shirt")


def test_short_p_path():
    assert _looks_like_product_url("https://shop.example.com/p/12345")


def test_item_path():
    assert _looks_like_product_url("https://shop.example.com/item/oxford-shirt")


def test_collection_pages_do_not_match():
    assert not _looks_like_product_url("https://shop.example.com/collections/shirts")
    assert not _looks_like_product_url("https://shop.example.com/collections/all")


def test_static_pages_do_not_match():
    assert not _looks_like_product_url("https://shop.example.com/pages/about-us")
    assert not _looks_like_product_url("https://shop.example.com/")


def test_case_and_query_string_are_ignored():
    assert _looks_like_product_url("https://shop.example.com/PRODUCTS/oxford-shirt?variant=1")
