"""Executable and static quality gates for the isolated HUX-06 frontend.""" from __future__ import annotations import json import subprocess from pathlib import Path ROOT = Path(__file__).resolve().parents[2] MODES = ROOT / "dockerfiles" / "hermes-webui-hux" / "modes" def test_hux_modes_model_node_suite_and_coverage(): """Mode intent validation is covered above the repository threshold.""" result = subprocess.run( [ "node", "--test", "--experimental-strip-types", "--experimental-test-coverage", "--test-coverage-lines=95", "--test-coverage-functions=95", "--test-coverage-include=dockerfiles/hermes-webui-hux/modes/model.ts", "testing/tests/test_hermes_hux_ui_modes.mjs", ], cwd=ROOT, check=False, capture_output=True, text=True, timeout=30, ) assert result.returncode == 0, result.stdout + result.stderr def test_hux_modes_component_is_flagged_accessible_and_provider_neutral(): """Static UI guardrails preserve keyboard access and neutral routing.""" component = (MODES / "FriendlyModeSelector.tsx").read_text(encoding="utf-8") model = (MODES / "model.ts").read_text(encoding="utf-8") styles = (MODES / "styles.css").read_text(encoding="utf-8") assert "if (!enabled) return null" in component assert "friendlyModesEnabled(flags)" in component assert "