|
@@ -0,0 +1,38 @@
|
|
|
|
|
+{
|
|
|
|
|
+ "name": "verify-switch",
|
|
|
|
|
+ "nodes": [
|
|
|
|
|
+ {"id": "n1", "name": "Trigger", "type": "click-trigger", "position": {"x": 0, "y": 0}, "config": {}},
|
|
|
|
|
+ {"id": "n2", "name": "Fixture", "type": "code", "position": {"x": 0, "y": 100},
|
|
|
|
|
+ "config": {"code": "return { status: 'pending' };"}},
|
|
|
|
|
+ {"id": "n3", "name": "Switch", "type": "switch", "position": {"x": 0, "y": 200},
|
|
|
|
|
+ "config": {
|
|
|
|
|
+ "field": "data.result.status",
|
|
|
|
|
+ "rules": [
|
|
|
|
|
+ {"label": "Paid", "operator": "equals", "value": "paid"},
|
|
|
|
|
+ {"label": "Pending", "operator": "equals", "value": "pending"},
|
|
|
|
|
+ {"label": "Failed", "operator": "equals", "value": "failed"}
|
|
|
|
|
+ ]
|
|
|
|
|
+ }},
|
|
|
|
|
+ {"id": "m0", "name": "M0", "type": "code", "position": {"x": -150, "y": 300},
|
|
|
|
|
+ "config": {"code": "return { marker: 'case0' };"}},
|
|
|
|
|
+ {"id": "m1", "name": "M1", "type": "code", "position": {"x": -50, "y": 300},
|
|
|
|
|
+ "config": {"code": "return { marker: 'case1' };"}},
|
|
|
|
|
+ {"id": "m2", "name": "M2", "type": "code", "position": {"x": 50, "y": 300},
|
|
|
|
|
+ "config": {"code": "return { marker: 'case2' };"}},
|
|
|
|
|
+ {"id": "mf", "name": "MF", "type": "code", "position": {"x": 150, "y": 300},
|
|
|
|
|
+ "config": {"code": "return { marker: 'fallback' };"}}
|
|
|
|
|
+ ],
|
|
|
|
|
+ "connections": [
|
|
|
|
|
+ {"sourceNodeId": "n1", "sourceOutput": "main", "targetNodeId": "n2", "targetInput": "data"},
|
|
|
|
|
+ {"sourceNodeId": "n2", "sourceOutput": "main", "targetNodeId": "n3", "targetInput": "data"},
|
|
|
|
|
+ {"sourceNodeId": "n3", "sourceOutput": "case0", "targetNodeId": "m0", "targetInput": "data"},
|
|
|
|
|
+ {"sourceNodeId": "n3", "sourceOutput": "case1", "targetNodeId": "m1", "targetInput": "data"},
|
|
|
|
|
+ {"sourceNodeId": "n3", "sourceOutput": "case2", "targetNodeId": "m2", "targetInput": "data"},
|
|
|
|
|
+ {"sourceNodeId": "n3", "sourceOutput": "fallback", "targetNodeId": "mf", "targetInput": "data"}
|
|
|
|
|
+ ],
|
|
|
|
|
+ "expect": {
|
|
|
|
|
+ "n3": {"status": "completed", "output": {"matchedRule": 1, "matchedLabel": "Pending", "_activeBranch": "case1"}},
|
|
|
|
|
+ "m1": {"status": "completed", "output": {"result": {"marker": "case1"}}}
|
|
|
|
|
+ },
|
|
|
|
|
+ "expectMissing": ["m0", "m2", "mf"]
|
|
|
|
|
+}
|