switch.json 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. {
  2. "name": "verify-switch",
  3. "nodes": [
  4. {"id": "n1", "name": "Trigger", "type": "click-trigger", "position": {"x": 0, "y": 0}, "config": {}},
  5. {"id": "n2", "name": "Fixture", "type": "code", "position": {"x": 0, "y": 100},
  6. "config": {"code": "return { status: 'pending' };"}},
  7. {"id": "n3", "name": "Switch", "type": "switch", "position": {"x": 0, "y": 200},
  8. "config": {
  9. "field": "data.result.status",
  10. "rules": [
  11. {"label": "Paid", "operator": "equals", "value": "paid"},
  12. {"label": "Pending", "operator": "equals", "value": "pending"},
  13. {"label": "Failed", "operator": "equals", "value": "failed"}
  14. ]
  15. }},
  16. {"id": "m0", "name": "M0", "type": "code", "position": {"x": -150, "y": 300},
  17. "config": {"code": "return { marker: 'case0' };"}},
  18. {"id": "m1", "name": "M1", "type": "code", "position": {"x": -50, "y": 300},
  19. "config": {"code": "return { marker: 'case1' };"}},
  20. {"id": "m2", "name": "M2", "type": "code", "position": {"x": 50, "y": 300},
  21. "config": {"code": "return { marker: 'case2' };"}},
  22. {"id": "mf", "name": "MF", "type": "code", "position": {"x": 150, "y": 300},
  23. "config": {"code": "return { marker: 'fallback' };"}}
  24. ],
  25. "connections": [
  26. {"sourceNodeId": "n1", "sourceOutput": "main", "targetNodeId": "n2", "targetInput": "data"},
  27. {"sourceNodeId": "n2", "sourceOutput": "main", "targetNodeId": "n3", "targetInput": "data"},
  28. {"sourceNodeId": "n3", "sourceOutput": "case0", "targetNodeId": "m0", "targetInput": "data"},
  29. {"sourceNodeId": "n3", "sourceOutput": "case1", "targetNodeId": "m1", "targetInput": "data"},
  30. {"sourceNodeId": "n3", "sourceOutput": "case2", "targetNodeId": "m2", "targetInput": "data"},
  31. {"sourceNodeId": "n3", "sourceOutput": "fallback", "targetNodeId": "mf", "targetInput": "data"}
  32. ],
  33. "expect": {
  34. "n3": {"status": "completed", "output": {"matchedRule": 1, "matchedLabel": "Pending", "_activeBranch": "case1"}},
  35. "m1": {"status": "completed", "output": {"result": {"marker": "case1"}}}
  36. },
  37. "expectMissing": ["m0", "m2", "mf"]
  38. }