From f7554b889a32b5b866cab3c15e776cf8f33bfdc8 Mon Sep 17 00:00:00 2001 From: Saberlve Date: Wed, 15 Apr 2026 12:12:12 +0800 Subject: [PATCH] test: split modal import ui contract --- tests/test_ui.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/tests/test_ui.py b/tests/test_ui.py index c750cbb..0313c0e 100644 --- a/tests/test_ui.py +++ b/tests/test_ui.py @@ -2,7 +2,7 @@ from zotero_kb.api import create_app from zotero_kb.config import AppConfig -def test_index_contains_import_modal_controls(tmp_path) -> None: +def _get_index_html(tmp_path) -> str: app = create_app( AppConfig( workspace_dir=tmp_path / "workspace", @@ -13,12 +13,22 @@ def test_index_contains_import_modal_controls(tmp_path) -> None: for route in app.routes: if getattr(route, "path", None) == "/" and "GET" in getattr(route, "methods", set()): - html = route.endpoint() - break - else: - raise AssertionError("GET / route not found") + return route.endpoint() + + raise AssertionError("GET / route not found") + + +def test_index_contains_base_page_forms(tmp_path) -> None: + html = _get_index_html(tmp_path) assert 'id="create-project-form"' in html + assert 'id="recommend-form"' in html + assert 'id="plan-form"' in html + + +def test_index_contains_import_modal_controls(tmp_path) -> None: + html = _get_index_html(tmp_path) + assert 'id="open-import-modal-button"' in html assert 'id="import-modal"' in html assert 'id="close-import-modal-button"' in html @@ -31,5 +41,3 @@ def test_index_contains_import_modal_controls(tmp_path) -> None: assert 'id="item-preview-popover"' in html assert 'const ABSTRACT_PREVIEW_DELAY_MS = 3000;' in html assert 'isImportModalOpen: false' in html - assert 'id="recommend-form"' in html - assert 'id="plan-form"' in html