if-condition-resolvable-path-both-branches.json 2.6 KB

123456789101112131415161718192021222324252627282930313233343536
  1. {
  2. "name": "verify-if-condition-resolvable-path-both-branches",
  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: 'paid', amount: 42 };"}},
  7. {"id": "ifTrue", "name": "IfTrue", "type": "if-condition", "position": {"x": -150, "y": 200},
  8. "config": {"conditions": [{"field": "data.result.status", "operator": "equals", "value": "paid"}], "combineWith": "and"}},
  9. {"id": "ifFalse", "name": "IfFalse", "type": "if-condition", "position": {"x": 150, "y": 200},
  10. "config": {"conditions": [{"field": "data.result.status", "operator": "equals", "value": "refunded"}], "combineWith": "and"}},
  11. {"id": "onTrue", "name": "OnTrue", "type": "code", "position": {"x": -200, "y": 300},
  12. "config": {"code": "return { marker: 'true-branch-ran' };"}},
  13. {"id": "onTrueUnexpected", "name": "OnTrueUnexpected", "type": "code", "position": {"x": -100, "y": 300},
  14. "config": {"code": "return { marker: 'should not run' };"}},
  15. {"id": "onFalseUnexpected", "name": "OnFalseUnexpected", "type": "code", "position": {"x": 100, "y": 300},
  16. "config": {"code": "return { marker: 'should not run' };"}},
  17. {"id": "onFalse", "name": "OnFalse", "type": "code", "position": {"x": 200, "y": 300},
  18. "config": {"code": "return { marker: 'false-branch-ran' };"}}
  19. ],
  20. "connections": [
  21. {"sourceNodeId": "n1", "sourceOutput": "main", "targetNodeId": "n2", "targetInput": "data"},
  22. {"sourceNodeId": "n2", "sourceOutput": "main", "targetNodeId": "ifTrue", "targetInput": "data"},
  23. {"sourceNodeId": "n2", "sourceOutput": "main", "targetNodeId": "ifFalse", "targetInput": "data"},
  24. {"sourceNodeId": "ifTrue", "sourceOutput": "true", "targetNodeId": "onTrue", "targetInput": "data"},
  25. {"sourceNodeId": "ifTrue", "sourceOutput": "false", "targetNodeId": "onTrueUnexpected", "targetInput": "data"},
  26. {"sourceNodeId": "ifFalse", "sourceOutput": "true", "targetNodeId": "onFalseUnexpected", "targetInput": "data"},
  27. {"sourceNodeId": "ifFalse", "sourceOutput": "false", "targetNodeId": "onFalse", "targetInput": "data"}
  28. ],
  29. "expect": {
  30. "ifTrue": {"status": "completed", "output": {"result": true, "_activeBranch": "true"}},
  31. "ifFalse": {"status": "completed", "output": {"result": false, "_activeBranch": "false"}},
  32. "onTrue": {"status": "completed", "output": {"result": {"marker": "true-branch-ran"}}},
  33. "onFalse": {"status": "completed", "output": {"result": {"marker": "false-branch-ran"}}}
  34. },
  35. "expectMissing": ["onTrueUnexpected", "onFalseUnexpected"]
  36. }