From aec6bcd92cf6d3f1476a18053f321e9a0bda199f Mon Sep 17 00:00:00 2001 From: yyh Date: Fri, 2 Jan 2026 21:54:54 +0800 Subject: [PATCH] fix test --- .../actions/commands/banana.spec.tsx | 22 +++++++++---------- .../actions/commands/vibe.spec.tsx | 8 +++---- .../components/goto-anything/index.spec.tsx | 1 + .../workflow/panel/vibe-panel/index.spec.tsx | 9 ++++++++ 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/web/app/components/goto-anything/actions/commands/banana.spec.tsx b/web/app/components/goto-anything/actions/commands/banana.spec.tsx index 47a1418aba..86d46d7355 100644 --- a/web/app/components/goto-anything/actions/commands/banana.spec.tsx +++ b/web/app/components/goto-anything/actions/commands/banana.spec.tsx @@ -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' }), ) }) diff --git a/web/app/components/goto-anything/actions/commands/vibe.spec.tsx b/web/app/components/goto-anything/actions/commands/vibe.spec.tsx index fd3320d92e..bfd4677e79 100644 --- a/web/app/components/goto-anything/actions/commands/vibe.spec.tsx +++ b/web/app/components/goto-anything/actions/commands/vibe.spec.tsx @@ -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') }) }) diff --git a/web/app/components/goto-anything/index.spec.tsx b/web/app/components/goto-anything/index.spec.tsx index adcadfa1fa..40cd54f1f4 100644 --- a/web/app/components/goto-anything/index.spec.tsx +++ b/web/app/components/goto-anything/index.spec.tsx @@ -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', () => ({ diff --git a/web/app/components/workflow/panel/vibe-panel/index.spec.tsx b/web/app/components/workflow/panel/vibe-panel/index.spec.tsx index 7b2cb4bd8f..5c98a171f6 100644 --- a/web/app/components/workflow/panel/vibe-panel/index.spec.tsx +++ b/web/app/components/workflow/panel/vibe-panel/index.spec.tsx @@ -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, })