mirror of https://github.com/langgenius/dify.git
feat(tests): add mock for useInvalidateWorkflowRunHistory in pipeline run tests (#32234)
This commit is contained in:
parent
378a1d7d08
commit
5b4c7b2a40
|
|
@ -92,8 +92,10 @@ vi.mock('@/service/workflow', () => ({
|
|||
}))
|
||||
|
||||
const mockInvalidAllLastRun = vi.fn()
|
||||
const mockInvalidateRunHistory = vi.fn()
|
||||
vi.mock('@/service/use-workflow', () => ({
|
||||
useInvalidAllLastRun: () => mockInvalidAllLastRun,
|
||||
useInvalidateWorkflowRunHistory: () => mockInvalidateRunHistory,
|
||||
}))
|
||||
|
||||
// Mock FlowType
|
||||
|
|
@ -472,6 +474,7 @@ describe('usePipelineRun', () => {
|
|||
})
|
||||
|
||||
expect(onWorkflowStarted).toHaveBeenCalledWith({ task_id: 'task-1' })
|
||||
expect(mockInvalidateRunHistory).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('should call onWorkflowFinished callback when provided', async () => {
|
||||
|
|
@ -493,6 +496,7 @@ describe('usePipelineRun', () => {
|
|||
})
|
||||
|
||||
expect(onWorkflowFinished).toHaveBeenCalledWith({ status: 'succeeded' })
|
||||
expect(mockInvalidateRunHistory).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('should call onError callback when provided', async () => {
|
||||
|
|
@ -514,6 +518,7 @@ describe('usePipelineRun', () => {
|
|||
})
|
||||
|
||||
expect(onError).toHaveBeenCalledWith({ message: 'error' })
|
||||
expect(mockInvalidateRunHistory).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('should call onNodeStarted callback when provided', async () => {
|
||||
|
|
|
|||
|
|
@ -2299,7 +2299,7 @@
|
|||
},
|
||||
"app/components/base/markdown-blocks/code-block.tsx": {
|
||||
"react-hooks-extra/no-direct-set-state-in-use-effect": {
|
||||
"count": 10
|
||||
"count": 7
|
||||
},
|
||||
"tailwindcss/enforce-consistent-class-order": {
|
||||
"count": 1
|
||||
|
|
|
|||
Loading…
Reference in New Issue