# SPDX-License-Identifier: MIT # Copyright (c) 2026 Rug Munch Media LLC # # Part of Pry — https://git.rugmunch.io/RugMunchMedia/pryscraper # Licensed under MIT. See LICENSE. """Tests for data enrichment pipeline.""" from enrichment import ( TECH_PATTERNS, detect_tech_stack, extract_company_info, extract_social_profiles, ) def test_detect_tech_wordpress() -> None: html = '' result = detect_tech_stack(html) assert "wordpress" in result["detected"] def test_detect_tech_shopify() -> None: html = '' result = detect_tech_stack(html) assert "shopify" in result["detected"] def test_detect_tech_nextjs() -> None: html = "" result = detect_tech_stack(html) assert "nextjs" in result["detected"] def test_detect_tech_cloudflare() -> None: html = "" result = detect_tech_stack(html, {"server": "cloudflare"}) assert "cloudflare" in result["detected"] def test_detect_tech_empty() -> None: result = detect_tech_stack("", {}) assert result["count"] == 0 def test_extract_social_twitter() -> None: html = 'Follow us on Twitter' result = extract_social_profiles(html) assert "pry_scraper" in str(result["profiles"]) def test_extract_social_linkedin() -> None: html = 'Connect on LinkedIn' result = extract_social_profiles(html) assert "pry-inc" in str(result["profiles"]) def test_extract_company_email() -> None: html = "Contact us at info@example.com for inquiries" result = extract_company_info(html) assert len(result.get("emails", [])) >= 1 assert "info@example.com" in result["emails"] def test_extract_company_founded() -> None: html = "Founded in 2020, we have been growing ever since." result = extract_company_info(html) assert result.get("founded_year") == "2020" def test_tech_patterns_exist() -> None: assert "wordpress" in TECH_PATTERNS assert "shopify" in TECH_PATTERNS assert "nextjs" in TECH_PATTERNS assert "cloudflare" in TECH_PATTERNS assert "stripe" in TECH_PATTERNS