Files
govoplan-search/tests/test_documentation.py
zemion 6ad7c6e0ef
Module Package Release / publish-packages (push) Successful in 11s
Release govoplan-search v0.1.20: centralize filtering and refresh behavior
2026-09-08 01:32:53 +02:00

53 lines
2.3 KiB
Python

from __future__ import annotations
import unittest
from govoplan_core.core.modules import (
documentation_structured_translation_issues,
user_workflow_scope_condition_issues,
)
from govoplan_search.backend.manifest import manifest
class SearchDocumentationTests(unittest.TestCase):
def test_public_topics_have_complete_german_reference_content(self) -> None:
self.assertEqual(2, len(manifest.documentation))
for topic in manifest.documentation:
translation = topic.translations.get("de", {})
self.assertTrue(
all(translation.get(key) for key in ("title", "summary", "body"))
)
self.assertEqual((), documentation_structured_translation_issues(topic))
def test_documentation_has_scope_conditioned_workflow_and_reference(self) -> None:
kinds = {topic.metadata.get("kind") for topic in manifest.documentation}
self.assertIn("workflow", kinds)
self.assertIn("reference", kinds)
for topic in manifest.documentation:
self.assertEqual((), user_workflow_scope_condition_issues(topic))
def test_filter_workflow_documents_tri_state_context_and_stale_reads(self) -> None:
topic = next(
item
for item in manifest.documentation
if item.id == "search.global-and-contextual"
)
steps = " ".join(topic.metadata["steps"])
german = topic.structured_translations["de"]
german_steps = " ".join(german["steps"])
self.assertIn("Modules and Result types dropdowns", steps)
self.assertIn("Deselect all intentionally shows no results", steps)
self.assertIn("Clear filters keeps the selected context and query", steps)
self.assertIn("Escape closes the open dropdown first", steps)
self.assertIn("Alle abwählen zeigt bewusst keine Ergebnisse", german_steps)
self.assertIn("gewählten Kontext und Suchbegriff", german_steps)
self.assertIn("Escape schließt zuerst", german_steps)
for metadata in (topic.metadata, german):
self.assertIn("change_filters", metadata["operational_consequences"])
self.assertEqual(4, len(metadata["limitations"]))
self.assertEqual(5, len(metadata["verification"]))
if __name__ == "__main__":
unittest.main()