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