#!/usr/bin/env python3 """Keep operator navigation guidance tied to the shipped routes and tab labels. These checks cover documentation accuracy, not collection or appliance health. """ from pathlib import Path import re import unittest ROOT = Path(__file__).resolve().parents[2] def doc_text(name: str) -> str: return (ROOT / "docs" / name).read_text(encoding="utf-8") def source(name: str) -> str: return (ROOT / "frontend-modern/src" / name).read_text(encoding="utf-8") class NavigationHelpDocsTest(unittest.TestCase): def test_entry_routes_match_the_registered_platform_routes(self): guide = doc_text("TROUBLESHOOTING.md").split("#### Old bookmarks don't work", 1)[1] guide = guide.split("### Relay / Mobile", 1)[0] links = source("routing/resourceLinks.ts") app = source("App.tsx") for label, prefix in (("Proxmox", "PROXMOX"), ("Docker", "DOCKER"), ("Kubernetes", "KUBERNETES"), ("TrueNAS", "TRUENAS"), ("vSphere", "VMWARE"), ("Machines", "STANDALONE")): with self.subTest(platform=label): path = re.search(rf"export const {prefix}_PATH = '([^']+)';", links).group(1) tab = re.search(rf"export const {prefix}_DEFAULT_TAB = '([^']+)';", links).group(1) self.assertIn(f"| {label} | `{path}/{tab}` |", guide) self.assertIn(f'