From bab23bbbbc6519f1915d4b8ffa5a0cf984d30802 Mon Sep 17 00:00:00 2001 From: ryan-crabbe-berri Date: Sat, 6 Jun 2026 21:17:03 -0700 Subject: [PATCH] test(ui): restore empty-string searchEmail guard for useInfiniteUsers Re-add the regression test verifying useInfiniteUsers(50, "") sends no user_email query param, so a future change from the truthiness check to a strict undefined check would fail instead of silently forwarding empty strings. --- .../src/app/(dashboard)/hooks/users/useUsers.test.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ui/litellm-dashboard/src/app/(dashboard)/hooks/users/useUsers.test.ts b/ui/litellm-dashboard/src/app/(dashboard)/hooks/users/useUsers.test.ts index eab2476809e..bd766c3171d 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/hooks/users/useUsers.test.ts +++ b/ui/litellm-dashboard/src/app/(dashboard)/hooks/users/useUsers.test.ts @@ -130,6 +130,14 @@ describe("useInfiniteUsers", () => { expect(lastRequestUrl(mock).searchParams.has("user_email")).toBe(false); }); + it("omits user_email when searchEmail is an empty string", async () => { + const mock = stubPagedFetch(1); + const { result } = renderHook(() => useInfiniteUsers(50, ""), { wrapper }); + + await waitFor(() => expect(result.current.isSuccess).toBe(true)); + expect(lastRequestUrl(mock).searchParams.has("user_email")).toBe(false); + }); + it("fetches the next page with an incremented page param", async () => { const mock = stubPagedFetch(3); const { result } = renderHook(() => useInfiniteUsers(), { wrapper });