"""Tests para normalize_entity_name."""

import sys
import os

sys.path.insert(0, os.path.dirname(__file__))

from normalize_entity_name import normalize_entity_name


def test_person_strip_whitespace():
    assert normalize_entity_name("  John Smith  ", "person") == "John Smith"


def test_person_apellido_nombre():
    assert normalize_entity_name("Smith, John", "person") == "John Smith"


def test_person_titulo():
    assert normalize_entity_name("Dr. Jane Doe", "person") == "Jane Doe"


def test_organization_llc():
    assert normalize_entity_name("Google LLC", "organization") == "Google"


def test_organization_corp():
    assert normalize_entity_name("ACME Corp.", "organization") == "Acme"


def test_ip_sin_cambio():
    assert normalize_entity_name("192.168.1.1", "ip") == "192.168.1.1"


def test_email_lowercase():
    assert normalize_entity_name("user@GMAIL.com", "email") == "user@gmail.com"


def test_domain_www_y_trailing_dot():
    assert normalize_entity_name("www.example.com.", "domain") == "example.com"


def test_phone_formato():
    assert normalize_entity_name("+1 (555) 123-4567", "phone") == "+15551234567"


def test_default_lowercase():
    assert normalize_entity_name("  Hello WORLD  ") == "hello world"


def test_default_colapsa_espacios():
    assert normalize_entity_name("foo   bar") == "foo bar"


def test_crypto_wallet_case_sensitive():
    wallet = "1A1zP1eP5QGefi2DMPTfTL5SLmv7Divf"
    assert normalize_entity_name(wallet, "crypto_wallet") == wallet


def test_domain_solo_trailing_dot():
    assert normalize_entity_name("example.com.", "domain") == "example.com"


def test_person_prof_titulo():
    assert normalize_entity_name("Prof. Alan Turing", "person") == "Alan Turing"


if __name__ == "__main__":
    import pytest
    pytest.main([__file__, "-v"])
