mirror of
https://github.com/langgenius/dify.git
synced 2026-04-22 11:47:40 +08:00
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:
@ -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: [],
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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,
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user