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

Function createTestWorkflow

apps/sim/executor/variables/resolvers/loop.test.ts:20–50  ·  view source on GitHub ↗
(
  loops: Record<string, LoopDef> = {},
  blockDefs: BlockDef[] = [],
  parallels: Record<string, { id?: string; nodes: string[] }> = {}
)

Source from the content-addressed store, hash-verified

18}
19
20function createTestWorkflow(
21 loops: Record<string, LoopDef> = {},
22 blockDefs: BlockDef[] = [],
23 parallels: Record<string, { id?: string; nodes: string[] }> = {}
24) {
25 const normalizedLoops: Record<string, { id: string; nodes: string[]; iterations: number }> = {}
26 for (const [key, loop] of Object.entries(loops)) {
27 normalizedLoops[key] = {
28 id: loop.id ?? key,
29 nodes: loop.nodes,
30 iterations: loop.iterations ?? 1,
31 ...(loop.loopType && { loopType: loop.loopType }),
32 }
33 }
34 const blocks = blockDefs.map((b) => ({
35 id: b.id,
36 position: { x: 0, y: 0 },
37 config: { tool: 'test', params: {} },
38 inputs: {},
39 outputs: {},
40 metadata: { id: 'function', name: b.name },
41 enabled: true,
42 }))
43 return {
44 version: '1.0',
45 blocks,
46 connections: [],
47 loops: normalizedLoops,
48 parallels,
49 }
50}
51
52function createLoopScope(overrides: Partial<LoopScope> = {}): LoopScope {
53 return {

Callers 1

loop.test.tsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected