mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-07 07:55:16 +02:00
chore: add more fixtures
This commit is contained in:
parent
5a358d4d29
commit
45a81c88e0
3 changed files with 33 additions and 6 deletions
|
|
@ -222,23 +222,26 @@ class WorkflowGraph:
|
|||
|
||||
def _assert_start_node(self):
|
||||
errors: list[WorkflowError] = []
|
||||
start_node = [n for n in self.nodes.values() if n.data.is_start]
|
||||
if not start_node:
|
||||
start_nodes = [n for n in self.nodes.values() if n.data.is_start]
|
||||
if not start_nodes:
|
||||
errors.append(
|
||||
WorkflowError(
|
||||
kind=ItemKind.workflow,
|
||||
id=None,
|
||||
field=None,
|
||||
message="Workflow must have exactly one start node",
|
||||
message="Workflow has no start node — exactly one is required",
|
||||
)
|
||||
)
|
||||
elif len(start_node) > 1:
|
||||
elif len(start_nodes) > 1:
|
||||
errors.append(
|
||||
WorkflowError(
|
||||
kind=ItemKind.workflow,
|
||||
id=None,
|
||||
field=None,
|
||||
message="Workflow must have exactly one start node",
|
||||
message=(
|
||||
f"Workflow has {len(start_nodes)} start nodes — "
|
||||
f"exactly one is required"
|
||||
),
|
||||
)
|
||||
)
|
||||
return errors
|
||||
|
|
|
|||
17
api/tests/dto_fixtures/multiple_start_nodes.json
Normal file
17
api/tests/dto_fixtures/multiple_start_nodes.json
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"nodes": [
|
||||
{
|
||||
"id": "s1",
|
||||
"type": "startCall",
|
||||
"position": {"x": 0, "y": 0},
|
||||
"data": {"name": "Start A", "prompt": "Greet path A.", "is_start": true}
|
||||
},
|
||||
{
|
||||
"id": "s2",
|
||||
"type": "startCall",
|
||||
"position": {"x": 0, "y": 200},
|
||||
"data": {"name": "Start B", "prompt": "Greet path B.", "is_start": true}
|
||||
}
|
||||
],
|
||||
"edges": []
|
||||
}
|
||||
|
|
@ -72,7 +72,14 @@ _SCENARIOS = [
|
|||
(
|
||||
"no_start_node",
|
||||
["no_start_node"],
|
||||
["Workflow must have exactly one start node"],
|
||||
["Workflow has no start node"],
|
||||
),
|
||||
# Two startCall nodes — surfaced separately from no_start_node so
|
||||
# the editor can show a count-specific message.
|
||||
(
|
||||
"multiple_start_nodes",
|
||||
["multiple_start_nodes:2"],
|
||||
["Workflow has 2 start nodes"],
|
||||
),
|
||||
]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue