split-aggregate.json 1.6 KB

12345678910111213141516171819202122232425
  1. {
  2. "name": "verify-split-aggregate",
  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 { region: 'EU', orders: [{sku: 'a', tier: 'x'}, {sku: 'b', tier: 'y'}, {sku: 'c', tier: 'x'}] };"}},
  7. {"id": "n3", "name": "Split", "type": "split-out", "position": {"x": 0, "y": 200},
  8. "config": {"field": "data.result.orders", "include": "none"}},
  9. {"id": "n4", "name": "Flat", "type": "aggregate", "position": {"x": -100, "y": 300},
  10. "config": {"inputField": "data.items", "outputField": "skus", "fieldToAggregate": "sku"}},
  11. {"id": "n5", "name": "Grouped", "type": "aggregate", "position": {"x": 100, "y": 300},
  12. "config": {"inputField": "data.items", "outputField": "items", "groupBy": "tier"}}
  13. ],
  14. "connections": [
  15. {"sourceNodeId": "n1", "sourceOutput": "main", "targetNodeId": "n2", "targetInput": "data"},
  16. {"sourceNodeId": "n2", "sourceOutput": "main", "targetNodeId": "n3", "targetInput": "data"},
  17. {"sourceNodeId": "n3", "sourceOutput": "main", "targetNodeId": "n4", "targetInput": "data"},
  18. {"sourceNodeId": "n3", "sourceOutput": "main", "targetNodeId": "n5", "targetInput": "data"}
  19. ],
  20. "expect": {
  21. "n3": {"status": "completed", "output": {"count": 3, "items": [{"sku": "a"}, {"sku": "b"}, {"sku": "c"}]}},
  22. "n4": {"status": "completed", "output": {"count": 3, "skus": ["a", "b", "c"]}},
  23. "n5": {"status": "completed", "output": {"count": 3, "groups": 2}}
  24. }
  25. }