From 87b0b06960c5a0aa71d4ff6f8aecdc9897613106 Mon Sep 17 00:00:00 2001 From: dongfubao Date: Thu, 24 Apr 2025 11:54:35 +0800 Subject: [PATCH] test: mock dependencies in workflow-init.spec.ts for unit tests --- .../components/workflow/utils/workflow-init.spec.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/web/app/components/workflow/utils/workflow-init.spec.ts b/web/app/components/workflow/utils/workflow-init.spec.ts index 8b7bdfaa92..d96e54a76a 100644 --- a/web/app/components/workflow/utils/workflow-init.spec.ts +++ b/web/app/components/workflow/utils/workflow-init.spec.ts @@ -5,6 +5,18 @@ import type { } from '@/app/components/workflow/types' import { CUSTOM_ITERATION_START_NODE } from '@/app/components/workflow/nodes/iteration-start/constants' +jest.mock('ky', () => ({ + __esModule: true, + default: { + create: jest.fn(), + }, +})) + +jest.mock('lodash-es/groupBy', () => ({ + __esModule: true, + default: jest.fn(), +})) + describe('preprocessNodesAndEdges', () => { it('process nodes without iteration node or loop node should return origin nodes and edges.', () => { const nodes = [