Add instance system guide nav (default off) with overview/options/hedge manual.
EOF Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -28,6 +28,13 @@ class TestInstanceDisplayPrefs(unittest.TestCase):
|
||||
on = normalize_display_prefs({"show_nav_dashboard": True})
|
||||
self.assertTrue(tab_allowed("dashboard", on))
|
||||
|
||||
def test_system_guide_nav_default_off(self):
|
||||
prefs = normalize_display_prefs({})
|
||||
self.assertFalse(prefs["show_nav_system_guide"])
|
||||
self.assertFalse(tab_allowed("system_guide", prefs))
|
||||
on = normalize_display_prefs({"show_nav_system_guide": True})
|
||||
self.assertTrue(tab_allowed("system_guide", on))
|
||||
|
||||
|
||||
class TestEnvFileLib(unittest.TestCase):
|
||||
def test_upsert_and_read(self):
|
||||
|
||||
@@ -30,9 +30,11 @@ def test_embed_tabs_cover_main_nav():
|
||||
assert "records" in EMBED_TABS
|
||||
assert "env_config" in EMBED_TABS
|
||||
assert "risk_policy" in EMBED_TABS
|
||||
assert "system_guide" in EMBED_TABS
|
||||
assert "settings" in EMBED_TABS
|
||||
assert path_to_embed_tab("/env_config") == "env_config"
|
||||
assert path_to_embed_tab("/risk_policy") == "risk_policy"
|
||||
assert path_to_embed_tab("/system_guide") == "system_guide"
|
||||
assert path_to_embed_tab("/settings") == "settings"
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
"""系统说明 Markdown 加载与目录."""
|
||||
from __future__ import annotations
|
||||
|
||||
from lib.instance.instance_system_guide_lib import (
|
||||
load_system_guide_payload,
|
||||
system_guide_md_path,
|
||||
system_guide_template_context,
|
||||
)
|
||||
|
||||
|
||||
def test_system_guide_md_exists():
|
||||
assert system_guide_md_path().is_file()
|
||||
|
||||
|
||||
def test_system_guide_payload_has_toc_and_html():
|
||||
payload = load_system_guide_payload()
|
||||
assert payload["html"]
|
||||
assert "系统说明" in payload["html"] or "总览" in payload["html"]
|
||||
toc = payload["toc"]
|
||||
assert isinstance(toc, list)
|
||||
assert len(toc) >= 3
|
||||
assert all(item.get("id") and item.get("title") for item in toc)
|
||||
assert any("总览" in (item.get("title") or "") for item in toc)
|
||||
assert any("期权" in (item.get("title") or "") for item in toc)
|
||||
assert any("对冲" in (item.get("title") or "") for item in toc)
|
||||
|
||||
|
||||
def test_system_guide_template_context():
|
||||
ctx = system_guide_template_context()
|
||||
assert ctx["system_guide_html"]
|
||||
assert ctx["system_guide_toc"]
|
||||
Reference in New Issue
Block a user