68 lines
2.5 KiB
Python
68 lines
2.5 KiB
Python
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
import unittest
|
|
|
|
from govoplan_workflow.backend.manifest import get_manifest
|
|
|
|
|
|
class WorkflowManifestTests(unittest.TestCase):
|
|
def test_manifest_is_an_editor_only_engine_client(self) -> None:
|
|
manifest = get_manifest()
|
|
|
|
self.assertEqual("workflow", manifest.id)
|
|
self.assertEqual("0.1.21", manifest.version)
|
|
self.assertEqual(("workflow_engine",), manifest.dependencies)
|
|
self.assertEqual(
|
|
{"workflow.definition_graph", "workflow.definition_catalogue", "workflow.bpmn_interchange"},
|
|
{item.name for item in manifest.requires_interfaces},
|
|
)
|
|
self.assertIn(
|
|
"workflow.editor",
|
|
{item.name for item in manifest.provides_interfaces},
|
|
)
|
|
self.assertEqual((), manifest.permissions)
|
|
self.assertIsNone(manifest.route_factory)
|
|
self.assertIsNone(manifest.migration_spec)
|
|
self.assertIn("documentation.semantic_subjects.workflow", manifest.capability_factories)
|
|
self.assertIn("docs", manifest.optional_dependencies)
|
|
self.assertIn(
|
|
"documentation.semantic_subjects.workflow",
|
|
{item.name for item in manifest.provides_interfaces},
|
|
)
|
|
self.assertIn(
|
|
"workflow.semantic-documentation",
|
|
{topic.id for topic in manifest.documentation},
|
|
)
|
|
self.assertEqual(
|
|
"@govoplan/workflow-webui",
|
|
manifest.frontend.package_name if manifest.frontend else None,
|
|
)
|
|
|
|
for topic in manifest.documentation:
|
|
german = topic.translations.get("de", {})
|
|
self.assertTrue(
|
|
all(german.get(field) for field in ("title", "summary", "body")),
|
|
topic.id,
|
|
)
|
|
|
|
def test_editor_exposes_semantic_help_without_replacing_static_help(self) -> None:
|
|
root = Path(__file__).parents[1]
|
|
page = (root / "webui/src/features/workflow/WorkflowPage.tsx").read_text()
|
|
inspector = (
|
|
root / "webui/src/features/workflow/WorkflowInspector.tsx"
|
|
).read_text()
|
|
|
|
self.assertIn("workflow.semantic-documentation", {
|
|
topic.id for topic in get_manifest().documentation
|
|
})
|
|
self.assertIn('"semantic"', page)
|
|
self.assertIn('"workflow_definition"', page)
|
|
self.assertIn('target="_blank"', page)
|
|
self.assertIn('target="_blank"', inspector)
|
|
self.assertIn("workflow-node-${nodeId}", inspector)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|