from email_enrichment.scraper import build_candidate_urls, extract_emails


def test_extract_emails_mailto_and_plain():
    md = (
        "Contact the team at [John](mailto:john@acme.com). "
        "Backup line: hello@acme.com. Dup: HELLO@ACME.COM. "
        "Garbage: not-an-email@."
    )
    out = extract_emails(md)
    assert out == ["john@acme.com", "hello@acme.com"]


def test_extract_emails_empty():
    assert extract_emails("") == []


def test_build_candidate_urls():
    urls = build_candidate_urls("heyrowan.com", ["/about", "/team"])
    assert urls == ["https://heyrowan.com/about", "https://heyrowan.com/team"]
