Files
govoplan-tasks/tests/test_webui_contract.py
T

40 lines
1.3 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_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()