mirror of
https://github.com/langgenius/dify.git
synced 2026-02-24 18:05:11 +00:00
feat(tests): add mock for useInvalidateWorkflowRunHistory in pipeline run tests (#32234)
This commit is contained in:
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user