svrnty-hermes-webui-plugin/tests/unit/test_svrnty_nav_js.py

34 lines
978 B
Python

"""Static checks for the Svrnty sidebar navigation injection."""
from pathlib import Path
NAV_JS = Path(__file__).resolve().parents[2] / "static" / "svrnty_nav.js"
def test_project_graph_is_not_in_left_nav():
src = NAV_JS.read_text()
assert "Project Graph" not in src
assert "/plugins/svrnty/umbrella.html" not in src
assert "window.open" not in src
def test_svrnty_tabs_participate_in_panel_switching():
src = NAV_JS.read_text()
assert "const TABS = [" in src
assert "const OUR_IDS = TABS.map((t) => t.id)" in src
assert 'id: "canvas"' in src
def test_canvas_tab_is_registered():
src = NAV_JS.read_text()
assert '{ id: "canvas"' in src
assert "svrnty-showing-\" + id" in src
def test_cortex_os_tab_is_registered_once():
src = NAV_JS.read_text()
assert src.count('id: "cortex-os"') == 1
assert '"cortex-os":' in src
for tab_id in ['id: "adwright"', 'id: "bte"', 'id: "canvas"']:
assert tab_id in src