From e325db35a3e96049c6e98d232e41aaeb5cf0a18d Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Sat, 28 Feb 2026 10:16:56 -0800 Subject: [PATCH] [Fix] Add useUISettings mock to KeyInfoView test The test was failing with "No QueryClient set" after useUISettings was added to key_info_view.tsx. Mock the hook to avoid the dependency. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../templates/KeyInfoView.handleKeyUpdate.test.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ui/litellm-dashboard/src/components/templates/KeyInfoView.handleKeyUpdate.test.tsx b/ui/litellm-dashboard/src/components/templates/KeyInfoView.handleKeyUpdate.test.tsx index 00cf234393..0d88083c3f 100644 --- a/ui/litellm-dashboard/src/components/templates/KeyInfoView.handleKeyUpdate.test.tsx +++ b/ui/litellm-dashboard/src/components/templates/KeyInfoView.handleKeyUpdate.test.tsx @@ -254,6 +254,11 @@ vi.mock("@/app/(dashboard)/hooks/projects/useProjects", () => ({ useProjects: vi.fn().mockReturnValue({ data: [], isLoading: false }), })); +// Mock useUISettings hook +vi.mock("@/app/(dashboard)/hooks/uiSettings/useUISettings", () => ({ + useUISettings: vi.fn().mockReturnValue({ data: { values: {} }, isLoading: false }), +})); + // KeyEditView mock: triggers onSubmit with our injected form values vi.mock("./key_edit_view", async () => { const React = await import("react");