π OpenHands: AI-Driven Development
hotfix(test): add top-level mock for custom-toast-handlers in conversation-panel tests (#12220)
sp.wackbfe827596346
diff --git a/frontend/__tests__/components/features/conversation-panel/conversation-panel.test.tsx b/frontend/__tests__/components/features/conversation-panel/conversation-panel.test.tsxindex 95c4ca9521..7a7765f542 100644--- a/frontend/__tests__/components/features/conversation-panel/conversation-panel.test.tsx+++ b/frontend/__tests__/components/features/conversation-panel/conversation-panel.test.tsx@@ -16,6 +16,13 @@ vi.mock("#/hooks/mutation/use-unified-stop-conversation", () => ({}),}));+// Mock toast handlers to prevent unhandled rejection errors+vi.mock("#/utils/custom-toast-handlers", () => ({+ displaySuccessToast: vi.fn(),+ displayErrorToast: vi.fn(),+ TOAST_OPTIONS: {},+}));+describe("ConversationPanel", () => {const onCloseMock = vi.fn();const RouterStub = createRoutesStub([@@ -634,12 +641,6 @@ describe("ConversationPanel", () => {);updateConversationSpy.mockResolvedValue(true);- // Mock the toast function- const mockToast = vi.fn();- vi.mock("#/utils/custom-toast-handlers", () => ({- displaySuccessToast: mockToast,- }));-renderConversationPanel();const cards = await screen.findAllByTestId("conversation-card");@@ -767,10 +768,6 @@ describe("ConversationPanel", () => {);updateConversationSpy.mockRejectedValue(new Error("API Error"));- vi.mock("#/utils/custom-toast-handlers", () => ({- displayErrorToast: vi.fn(),- }));-renderConversationPanel();const cards = await screen.findAllByTestId("conversation-card");