π OpenHands: AI-Driven Development
fix(frontend): Failing tests (#8519)
sp.wack7490c1927ff6
diff --git a/frontend/__tests__/components/chat/action-suggestions.test.tsx b/frontend/__tests__/components/chat/action-suggestions.test.tsxindex 1a5d885667..e4928ee146 100644--- a/frontend/__tests__/components/chat/action-suggestions.test.tsx+++ b/frontend/__tests__/components/chat/action-suggestions.test.tsx@@ -4,6 +4,7 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";import { ActionSuggestions } from "#/components/features/chat/action-suggestions";import OpenHands from "#/api/open-hands";import { MOCK_DEFAULT_USER_SETTINGS } from "#/mocks/handlers";+import { ConversationProvider } from "#/context/conversation-context";// Mock dependenciesvi.mock("posthog-js", () => ({@@ -38,12 +39,20 @@ vi.mock("react-i18next", () => ({}),}));+vi.mock("react-router", () => ({+ useParams: () => ({+ conversationId: "test-conversation-id",+ }),+}));+const renderActionSuggestions = () =>render(<ActionSuggestions onSuggestionsClick={() => {}} />, {wrapper: ({ children }) => (- <QueryClientProvider client={new QueryClient()}>- {children}- </QueryClientProvider>+ <ConversationProvider>+ <QueryClientProvider client={new QueryClient()}>+ {children}+ </QueryClientProvider>+ </ConversationProvider>),});@@ -65,6 +74,11 @@ describe("ActionSuggestions", () => {});it("should render both GitHub buttons when GitHub token is set and repository is selected", async () => {+ const getConversationSpy = vi.spyOn(OpenHands, "getConversation");+ // @ts-expect-error - only required for testing+ getConversationSpy.mockResolvedValue({+ selected_repository: "test-repo",+ });renderActionSuggestions();// Find all buttons with data-testid="suggestion"