from pathlib import Path ROOT = Path(__file__).resolve().parents[1] APP_CONFIG = ROOT / "firmware" / "esp32" / "overland-controller" / "app_config.h" CONFIG = ROOT / "firmware" / "esp32" / "overland-controller" / "config.h" FIRMWARE = ROOT / "firmware" / "esp32" / "overland-controller" / "overland-controller.ino" def test_primary_docs_match_active_hardware_profile(): app_config = APP_CONFIG.read_text() config = CONFIG.read_text() readme = (ROOT / "README.md").read_text() hardware = (ROOT / "docs" / "HARDWARE.md").read_text() architecture = (ROOT / "docs" / "ARCHITECTURE.md").read_text() assert '#define MAX_RELAYS 6' in app_config assert '#define HARDWARE_PROFILE "lilygo_trelay_s3_6ch"' in app_config assert '#define ONEWIRE_PIN 15' in config for document in (readme, hardware, architecture): assert "LILYGO T-Relay-S3" in document assert "1024x600" in hardware assert "GPIO15" in hardware assert "800x480" not in hardware assert "GPIO 16: Relay" not in hardware assert "GPIO 4: DS18B20" not in hardware def test_api_docs_match_versioned_route_contract(): api = (ROOT / "docs" / "API.md").read_text() parity = (ROOT / "docs" / "PARITY_MATRIX.md").read_text() firmware = FIRMWARE.read_text() assert 'features["root_compatibility_aliases"] = false;' in firmware assert 'features["uart_json"] = DASHBOARD_UART_ENABLED == 1;' in firmware assert '"relay_count": 6' in api assert '"temperature_sensor_count": 4' in api assert '"root_compatibility_aliases": false' in api assert '"uart_json": false' in api assert "Legacy GET relay routes" not in api assert "Legacy root HTTP relay routes" not in parity