Skip to content

Commit 0103662

Browse files
committed
fix(executor): keep the condition-join loop test off the Redis-backed isolate lease
1 parent 85ea094 commit 0103662

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎apps/sim/executor/execution/condition-join-loop.test.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ import type { SerializedWorkflow } from '@/serializer/types'
1212

1313
vi.mock('@/tools', () => toolsMock)
1414

15+
/** A For loop's continuation check is `return Boolean(<index> < <count>)`; nothing here needs a real isolate. */
16+
vi.mock('@/lib/execution/isolated-vm', () => ({
17+
executeInIsolatedVM: vi.fn(async ({ code }: { code: string }) => {
18+
const indexCheck = /^return Boolean\((\d+) < (\d+)\)$/.exec(code)
19+
if (!indexCheck) throw new Error(`Unexpected isolated-vm code in test: ${code}`)
20+
return { result: Number(indexCheck[1]) < Number(indexCheck[2]) }
21+
}),
22+
}))
23+
1524
/** Real condition handler; every other block answers with its own name. */
1625
vi.mock('@/executor/handlers/registry', () => ({
1726
createBlockHandlers: () => [

0 commit comments

Comments
 (0)