mirror of
https://github.com/langgenius/dify.git
synced 2026-05-03 07:46:31 +08:00
fix test
This commit is contained in:
parent
89b29bd836
commit
aec6bcd92c
@ -48,7 +48,7 @@ describe('bananaCommand', () => {
|
|||||||
// Assert
|
// Assert
|
||||||
expect(bananaCommand.name).toBe('banana')
|
expect(bananaCommand.name).toBe('banana')
|
||||||
expect(bananaCommand.mode).toBe('submenu')
|
expect(bananaCommand.mode).toBe('submenu')
|
||||||
expect(bananaCommand.description).toContain('app.gotoAnything.actions.vibeDesc')
|
expect(bananaCommand.description).toContain('gotoAnything.actions.vibeDesc')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -91,16 +91,16 @@ describe('bananaCommand', () => {
|
|||||||
// Assert
|
// Assert
|
||||||
expect(result).toHaveLength(1)
|
expect(result).toHaveLength(1)
|
||||||
const [item] = result
|
const [item] = result
|
||||||
expect(item.description).toContain('app.gotoAnything.actions.vibeHint')
|
expect(item.description).toContain('gotoAnything.actions.vibeHint')
|
||||||
expect(item.data?.args?.dsl).toBe('')
|
expect(item.data?.args?.dsl).toBe('')
|
||||||
expect(item.data?.command).toBe('workflow.vibe')
|
expect(item.data?.command).toBe('workflow.vibe')
|
||||||
expect(mockedT).toHaveBeenCalledWith(
|
expect(mockedT).toHaveBeenCalledWith(
|
||||||
'app.gotoAnything.actions.vibeTitle',
|
'gotoAnything.actions.vibeTitle',
|
||||||
expect.objectContaining({ lng: 'en' }),
|
expect.objectContaining({ lng: 'en', ns: 'app' }),
|
||||||
)
|
)
|
||||||
expect(mockedT).toHaveBeenCalledWith(
|
expect(mockedT).toHaveBeenCalledWith(
|
||||||
'app.gotoAnything.actions.vibeHint',
|
'gotoAnything.actions.vibeHint',
|
||||||
expect.objectContaining({ prompt: expect.any(String), lng: 'en' }),
|
expect.objectContaining({ prompt: expect.any(String), lng: 'en', ns: 'app' }),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -114,16 +114,16 @@ describe('bananaCommand', () => {
|
|||||||
// Assert
|
// Assert
|
||||||
expect(result).toHaveLength(1)
|
expect(result).toHaveLength(1)
|
||||||
const [item] = result
|
const [item] = result
|
||||||
expect(item.description).toContain('app.gotoAnything.actions.vibeDesc')
|
expect(item.description).toContain('gotoAnything.actions.vibeDesc')
|
||||||
expect(item.data?.args?.dsl).toBe('make a flow')
|
expect(item.data?.args?.dsl).toBe('make a flow')
|
||||||
expect(item.data?.command).toBe('workflow.vibe')
|
expect(item.data?.command).toBe('workflow.vibe')
|
||||||
expect(mockedT).toHaveBeenCalledWith(
|
expect(mockedT).toHaveBeenCalledWith(
|
||||||
'app.gotoAnything.actions.vibeTitle',
|
'gotoAnything.actions.vibeTitle',
|
||||||
expect.objectContaining({ lng: 'fr' }),
|
expect.objectContaining({ lng: 'fr', ns: 'app' }),
|
||||||
)
|
)
|
||||||
expect(mockedT).toHaveBeenCalledWith(
|
expect(mockedT).toHaveBeenCalledWith(
|
||||||
'app.gotoAnything.actions.vibeDesc',
|
'gotoAnything.actions.vibeDesc',
|
||||||
expect.objectContaining({ lng: 'fr' }),
|
expect.objectContaining({ lng: 'fr', ns: 'app' }),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -79,11 +79,11 @@ describe('vibeCommand', () => {
|
|||||||
// Assert
|
// Assert
|
||||||
expect(result).toHaveLength(1)
|
expect(result).toHaveLength(1)
|
||||||
const [item] = result
|
const [item] = result
|
||||||
expect(item.description).toContain('app.gotoAnything.actions.vibeHint')
|
expect(item.description).toContain('gotoAnything.actions.vibeHint')
|
||||||
expect(item.data?.args?.dsl).toBe('')
|
expect(item.data?.args?.dsl).toBe('')
|
||||||
expect(mockedT).toHaveBeenCalledWith(
|
expect(mockedT).toHaveBeenCalledWith(
|
||||||
'app.gotoAnything.actions.vibeHint',
|
'gotoAnything.actions.vibeHint',
|
||||||
expect.objectContaining({ prompt: expect.any(String), lng: 'en' }),
|
expect.objectContaining({ prompt: expect.any(String), lng: 'en', ns: 'app' }),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ describe('vibeCommand', () => {
|
|||||||
// Assert
|
// Assert
|
||||||
expect(result).toHaveLength(1)
|
expect(result).toHaveLength(1)
|
||||||
const [item] = result
|
const [item] = result
|
||||||
expect(item.description).toContain('app.gotoAnything.actions.vibeDesc')
|
expect(item.description).toContain('gotoAnything.actions.vibeDesc')
|
||||||
expect(item.data?.args?.dsl).toBe('make a flow')
|
expect(item.data?.args?.dsl).toBe('make a flow')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -36,6 +36,7 @@ const triggerKeyPress = (combo: string) => {
|
|||||||
let mockQueryResult = { data: [] as SearchResult[], isLoading: false, isError: false, error: null as Error | null }
|
let mockQueryResult = { data: [] as SearchResult[], isLoading: false, isError: false, error: null as Error | null }
|
||||||
vi.mock('@tanstack/react-query', () => ({
|
vi.mock('@tanstack/react-query', () => ({
|
||||||
useQuery: () => mockQueryResult,
|
useQuery: () => mockQueryResult,
|
||||||
|
keepPreviousData: (data: unknown) => data,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
vi.mock('@/context/i18n', () => ({
|
vi.mock('@/context/i18n', () => ({
|
||||||
|
|||||||
@ -114,11 +114,20 @@ const renderVibePanel = ({
|
|||||||
mockUseVibeFlowData.mockReturnValue(vibeFlowData)
|
mockUseVibeFlowData.mockReturnValue(vibeFlowData)
|
||||||
|
|
||||||
const workflowStore = createWorkflowStore({})
|
const workflowStore = createWorkflowStore({})
|
||||||
|
const vibeFlowState = vibeFlowData
|
||||||
|
? {
|
||||||
|
vibeFlowVersions: vibeFlowData.versions,
|
||||||
|
vibeFlowCurrentIndex: vibeFlowData.currentVersionIndex,
|
||||||
|
currentVibeFlow: vibeFlowData.current,
|
||||||
|
}
|
||||||
|
: {}
|
||||||
|
|
||||||
workflowStore.setState({
|
workflowStore.setState({
|
||||||
showVibePanel: true,
|
showVibePanel: true,
|
||||||
isVibeGenerating: false,
|
isVibeGenerating: false,
|
||||||
vibePanelInstruction: '',
|
vibePanelInstruction: '',
|
||||||
vibePanelMermaidCode: '',
|
vibePanelMermaidCode: '',
|
||||||
|
...vibeFlowState,
|
||||||
...workflowState,
|
...workflowState,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user