fix: resolve test failures after segment 2 merge

- Backend: fix deduct_llm_quota import path in llm node
- Backend: update core.variables → core.workflow.variables imports
- Frontend: update UpdateWorkflowNodesMapPayload in tests
- Frontend: fix various test expectations to match merged code

Made-with: Cursor
This commit is contained in:
Novice
2026-03-23 09:18:26 +08:00
parent 66e67caa2b
commit cbdcdcc2b9
18 changed files with 44 additions and 45 deletions

View File

@ -488,17 +488,20 @@ describe('WorkflowVariableBlockComponent', () => {
/>,
)
const updateHandler = mockRegisterCommand.mock.calls[0][1] as (map: Record<string, unknown>) => boolean
const updateHandler = mockRegisterCommand.mock.calls[0][1] as (payload: { workflowNodesMap: Record<string, unknown>, nodeOutputVars: unknown[] }) => boolean
let result = false
act(() => {
result = updateHandler({
'node-1': {
title: 'Updated',
type: BlockEnum.LLM,
width: 100,
height: 50,
position: { x: 0, y: 0 },
workflowNodesMap: {
'node-1': {
title: 'Updated',
type: BlockEnum.LLM,
width: 100,
height: 50,
position: { x: 0, y: 0 },
},
},
nodeOutputVars: [],
})
})

View File

@ -106,7 +106,7 @@ describe('WorkflowVariableBlock', () => {
)
expect(mockUpdate).toHaveBeenCalled()
expect(mockDispatchCommand).toHaveBeenCalledWith(UPDATE_WORKFLOW_NODES_MAP, workflowNodesMap)
expect(mockDispatchCommand).toHaveBeenCalledWith(UPDATE_WORKFLOW_NODES_MAP, { workflowNodesMap, nodeOutputVars: [] })
})
it('should throw when WorkflowVariableBlockNode is not registered', () => {
@ -139,6 +139,10 @@ describe('WorkflowVariableBlock', () => {
['node-1', 'answer'],
workflowNodesMap,
getVarType,
undefined,
undefined,
undefined,
undefined,
)
expect($insertNodes).toHaveBeenCalledWith([{ id: 'workflow-node' }])
expect(onInsert).toHaveBeenCalledTimes(1)

View File

@ -189,6 +189,7 @@ describe('WorkflowVariableBlockReplacementBlock', () => {
{ variable: 'ragVarA', type: VarType.string, isRagVariable: true },
{ variable: 'rag.shared.answer', type: VarType.string, isRagVariable: true },
],
variables,
)
expect($applyNodeReplacement).toHaveBeenCalledWith({ type: 'workflow-node' })
expect(created).toEqual({ type: 'workflow-node' })
@ -216,6 +217,7 @@ describe('WorkflowVariableBlockReplacementBlock', () => {
[],
[],
undefined,
undefined,
)
})
})