test: 覆盖核心文档映射错误 (#2)

This commit is contained in:
QiuSW
2026-08-08 09:02:48 +08:00
parent b09658ee15
commit c8ccb62a98
2 changed files with 19 additions and 5 deletions
+11 -5
View File
@@ -165,6 +165,16 @@ def check_task_template(errors: list[str], root: Path = ROOT) -> None:
errors.append(f"单元任务模板缺少:{section}")
def core_mapping_errors(configured_mappings: dict[str, str]) -> list[str]:
errors: list[str] = []
for page, expected_path in CORE_PAGE_PATHS.items():
if configured_mappings.get(page) != expected_path:
errors.append(
f"核心 Wiki 页面映射缺失或路径错误:{page} -> {expected_path}"
)
return errors
def check_wiki_mirrors(errors: list[str]) -> None:
"""检查每份本地文档都有显式映射和可追踪的镜像头。"""
@@ -175,11 +185,7 @@ def check_wiki_mirrors(errors: list[str]) -> None:
return
configured_mappings = {mapping.page: mapping.path for mapping in config.mappings}
for page, expected_path in CORE_PAGE_PATHS.items():
if configured_mappings.get(page) != expected_path:
errors.append(
f"核心 Wiki 页面映射缺失或路径错误:{page} -> {expected_path}"
)
errors.extend(core_mapping_errors(configured_mappings))
mapped_paths = {mapping.path for mapping in config.mappings}
actual_paths = {