From 6de2a5f1d8acd548337f101c54b978eeb1b053a5 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 29 Jan 2026 18:50:03 +0000 Subject: [PATCH] Add test for user_id display in key info view - Test verifies user_id is displayed in the component - Uses getAllByText since user_id appears in both overview and settings tabs Co-authored-by: ishaan --- .../templates/key_info_view.test.tsx | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/ui/litellm-dashboard/src/components/templates/key_info_view.test.tsx b/ui/litellm-dashboard/src/components/templates/key_info_view.test.tsx index ebb664e18cd..4c7c827c250 100644 --- a/ui/litellm-dashboard/src/components/templates/key_info_view.test.tsx +++ b/ui/litellm-dashboard/src/components/templates/key_info_view.test.tsx @@ -320,4 +320,27 @@ describe("KeyInfoView", () => { expect(screen.queryByText("Delete Key")).not.toBeInTheDocument(); }); }); + + it("should display user_id in the overview section", async () => { + vi.mocked(useAuthorized).mockReturnValue(baseUseAuthorizedMock); + + render( + {}} + keyId={"test-key-id"} + onKeyDataUpdate={() => {}} + teams={[]} + />, + ); + + await waitFor(() => { + // User ID appears in multiple places (overview and settings tab) + const userIdElements = screen.getAllByText("User ID"); + expect(userIdElements.length).toBeGreaterThan(0); + // Verify the user_id value is displayed + const userIdValues = screen.getAllByText("default_user_id"); + expect(userIdValues.length).toBeGreaterThan(0); + }); + }); });