"""Debug test for URL utility functions."""

from local_deep_research.utilities.url_utils import normalize_ollama_url


def test_url_normalization():
    """Test the normalize_ollama_url function."""

    test_cases = [
        ("localhost:11434", "http://localhost:11434"),
        ("127.0.0.1:11434", "http://127.0.0.1:11434"),
        ("example.com:11434", "https://example.com:11434"),
        ("http:localhost:11434", "http://localhost:11434"),
        ("https:example.com:11434", "https://example.com:11434"),
        ("http://localhost:11434", "http://localhost:11434"),
        ("https://example.com:11434", "https://example.com:11434"),
        ("//localhost:11434", "http://localhost:11434"),
        ("//example.com:11434", "https://example.com:11434"),
        ("", "http://localhost:11434"),
    ]

    for input_url, expected in test_cases:
        result = normalize_ollama_url(input_url)
        if result != expected:
            print(f"FAIL: Input: {input_url!r}")
            print(f"  Expected: {expected!r}")
            print(f"  Got:      {result!r}")
        else:
            print(f"PASS: {input_url!r} -> {result!r}")


if __name__ == "__main__":
    test_url_normalization()
