Files
govoplan-tasks/tests/test_webui_contract.py
T
zemion faf6b3305a
Module Package Release / publish-packages (push) Successful in 11s
docs(tasks): complete German workflow coverage
2026-08-22 06:50:34 +02:00

55 lines
1.9 KiB
Python

from __future__ import annotations
from pathlib import Path
import unittest
from govoplan_tasks.backend.manifest import get_manifest
REPOSITORY_ROOT = Path(__file__).resolve().parents[1]
class TasksQuickAccessContractTests(unittest.TestCase):
def test_public_topics_have_complete_german_workflow_and_reference_coverage(
self,
) -> None:
topics = get_manifest().documentation
kinds = {topic.metadata.get("kind", "system") for topic in topics}
self.assertEqual(3, len(topics))
self.assertTrue({"workflow", "reference"}.issubset(kinds))
for topic in topics:
translation = topic.translations["de"]
self.assertEqual({"title", "summary", "body"}, set(translation))
self.assertTrue(
all(str(translation[field]).strip() for field in translation)
)
def test_manifest_declares_typed_work_result_and_help(self) -> None:
tool = get_manifest().frontend.quick_access_tools[0]
self.assertEqual("tasks.work", tool.id)
self.assertEqual(("tasks.work-item",), tool.returned_reference_kinds)
self.assertEqual("tasks.quick_access.work", tool.help_context_id)
self.assertEqual("/tasks", tool.full_page_path)
def test_renderer_is_bounded_and_keeps_commands_source_owned(self) -> None:
source = (
REPOSITORY_ROOT
/ "webui"
/ "src"
/ "features"
/ "tasks"
/ "TasksQuickAccess.tsx"
).read_text()
self.assertIn("limit: 7", source)
self.assertIn('selected.provider_id !== "tasks.explicit"', source)
self.assertIn("transitionTask(settings, selected, action)", source)
self.assertIn("quickAccessLaunchState(launchContext)", source)
self.assertIn('kind: "work-item"', source)
if __name__ == "__main__":
unittest.main()