# File: tests/unit/test_test_data_paths.py
# Purpose: Confirm test-data path helpers avoid polluting the repository root.
# Context: Validates functions exported from tests.conftest that normalise test directories.

from pathlib import Path

from tests import conftest as test_conftest


def test_get_test_manuscripts_path_returns_relative() -> None:
    """Ensure we expose a relative manuscripts directory for fixtures."""
    assert test_conftest.get_test_manuscripts_path() == "40_原稿"


def test_normalise_test_subdir_strips_temp_prefix() -> None:
    """Normalisation drops redundant temp/test_data prefixes."""
    cleaned = test_conftest.normalise_test_subdir("temp/test_data/50_管理資料")
    assert cleaned == "50_管理資料"


def test_tmp_path_combination_avoids_double_temp(tmp_path: Path) -> None:
    """Joining tmp_path with the relative manuscripts path should not double nest."""
    manuscript_dir = tmp_path / test_conftest.get_test_manuscripts_path()
    joined_str = str(manuscript_dir).replace("\\", "/")
    assert "temp/test_data/temp/test_data" not in joined_str
