MCPcopy Index your code
hub / github.com/simstudioai/sim / createNode

Function createNode

apps/sim/executor/utils/run-from-block.test.ts:17–47  ·  view source on GitHub ↗

* Helper to create a DAG node for testing

(
  id: string,
  outgoingEdges: Array<{ target: string; sourceHandle?: string }> = [],
  metadata: Partial<NodeMetadata> = {}
)

Source from the content-addressed store, hash-verified

15 * Helper to create a DAG node for testing
16 */
17function createNode(
18 id: string,
19 outgoingEdges: Array<{ target: string; sourceHandle?: string }> = [],
20 metadata: Partial<NodeMetadata> = {}
21): DAGNode {
22 const edges = new Map<string, DAGEdge>()
23 for (const edge of outgoingEdges) {
24 edges.set(edge.target, { target: edge.target, sourceHandle: edge.sourceHandle })
25 }
26
27 return {
28 id,
29 block: {
30 id,
31 position: { x: 0, y: 0 },
32 config: { tool: 'test', params: {} },
33 inputs: {},
34 outputs: {},
35 metadata: { id: 'test', name: `block-${id}`, category: 'tools' },
36 enabled: true,
37 },
38 incomingEdges: new Set<string>(),
39 outgoingEdges: edges,
40 metadata: {
41 isParallelBranch: false,
42 isLoopNode: false,
43 isSentinel: false,
44 ...metadata,
45 },
46 }
47}
48
49/**
50 * Helper to create a DAG for testing

Callers 1

Calls 1

setMethod · 0.65

Tested by

no test coverage detected