# app/tests/unit/integrations/exchange/test_symbol_utils.py

from __future__ import annotations

import pytest

from src.integrations.exchange.symbol_utils import (
    normalize_symbol as legacy_normalize_symbol,
)
from src.integrations.exchange.symbol_utils import (
    symbol_candidates as legacy_symbol_candidates,
)
from src.market_data.acquisition.symbols import (
    normalize_symbol as new_normalize_symbol,
)
from src.market_data.acquisition.symbols import (
    symbol_candidates as new_symbol_candidates,
)


@pytest.mark.parametrize(
    "raw_symbol",
    [
        "",
        " ",
        "btc/usd",
        " BTC/USD ",
        "btc%2fusd",
        "btc / usd",
        "btc%2f / usd",
        "eth/usd_leverage",
        "btc\t/usd",
        "btc\n/usd",
    ],
)
def test_legacy_normalize_symbol_matches_new_implementation(
    raw_symbol: str,
) -> None:
    assert (
        legacy_normalize_symbol(raw_symbol)
        == new_normalize_symbol(raw_symbol)
    )


@pytest.mark.parametrize(
    "raw_symbol",
    [
        "",
        " ",
        "btc/usd",
        " BTC/USD ",
        "btc%2fusd",
        "btc / usd",
        "btc%2f / usd",
        "eth/usd_leverage",
        "btc\t/usd",
        "btc\n/usd",
    ],
)
def test_legacy_symbol_candidates_matches_new_implementation(
    raw_symbol: str,
) -> None:
    assert (
        legacy_symbol_candidates(raw_symbol)
        == new_symbol_candidates(raw_symbol)
    )


def test_legacy_facade_exports_same_normalize_function() -> None:
    assert legacy_normalize_symbol is new_normalize_symbol


def test_legacy_facade_exports_same_candidates_function() -> None:
    assert legacy_symbol_candidates is new_symbol_candidates