"""Navigation (round 2, package 3). The 404 page's sidebar read "0 1 2 3 4". A sidebar group label was a link to its first page ("Handhelds and TV boxes" opened AmberELEC), and a crumb linked a sibling page. Emulators sat three levels deep under "D to F / D". Previous and next ran from Sony to Sord and from one tab into another, and disagreed with the page's own "Next" list. The Reference tab was a flat list of fifteen. These tests read the generator and, where it is built, the site. """ from __future__ import annotations import json import re import struct import sys import tempfile import unittest from html.parser import HTMLParser from pathlib import Path REPO_ROOT = Path(__file__).resolve().parents[1] sys.path.insert(0, str(REPO_ROOT / "scripts")) import generate_site # noqa: E402 import sitestarlight # noqa: E402 from common import list_registered_platforms, load_platform_config, load_platform_registry # noqa: E402 DIST = REPO_ROOT / "website" / "dist" ROUTE = REPO_ROOT / "website" / "src" / "routeData.ts" TAB_ROOTS = {"/retrobios/", "/retrobios/platforms/", "/retrobios/explore/", "/retrobios/wiki/", "/retrobios/contributing/"} def _nav() -> list: platforms = REPO_ROOT / "platforms" registry = load_platform_registry(str(platforms)) coverages = { key: {"platform": load_platform_config(key, str(platforms))["platform"]} for key in list_registered_platforms(str(platforms), include_archived=True) } manufacturers = {"Sony": {}, "Sega": {}, "ScummVM": {}} profiles = { "duckstation": {"emulator": "DuckStation", "systems": ["sony-playstation"]}, "dolphin": {"emulator": "Dolphin", "systems": ["nintendo-gamecube"]}, "mame": {"emulator": "MAME", "systems": ["arcade"]}, } return generate_site.generate_nav(coverages, manufacturers, profiles, registry) def _targets(value: object) -> set[str]: if isinstance(value, str): return {value} if isinstance(value, list): return set().union(*(_targets(v) for v in value)) if value else set() return set().union(*(_targets(v) for v in value.values())) def _present(nav: list) -> set[str]: return {t for t in _targets(nav) if not t.startswith("http")} # The setups index writes one `##