From 89d084962501ffb1409e58a13f0988b300ed3832 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 12 Aug 2026 04:35:30 +0000 Subject: [PATCH] fix(ui/tests): drop over-broad fetch-not-called assertion in admin-only page tests The Workflow Runs, Memory and Guardrails Monitor page.integration tests asserted that fetchMock was never called for non-admin roles, but useCan always calls useIsOrgAdmin, which fires GET /organization/list during render regardless of the capability being checked. That call is unrelated to the page-specific request the tests actually guard against, and the follow-up filter check on the page's URL already covers that intent, so the blanket assertion just made the suite flake red on every commit. Drop the redundant waitFor so the URL-scoped filter is the single source of truth for 'no page-specific request fires'. Co-authored-by: Krrish Dholakia --- .../app/(dashboard)/guardrails-monitor/page.integration.test.tsx | 1 - .../src/app/(dashboard)/memory/page.integration.test.tsx | 1 - .../src/app/(dashboard)/workflows/page.integration.test.tsx | 1 - 3 files changed, 3 deletions(-) diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails-monitor/page.integration.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails-monitor/page.integration.test.tsx index d4c68841299..e83354d322f 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails-monitor/page.integration.test.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails-monitor/page.integration.test.tsx @@ -46,7 +46,6 @@ describe("Guardrails Monitor page access by role", () => { renderAs(userRole); expect(await screen.findByText("Guardrails Monitor is only available to admin users.")).toBeInTheDocument(); - await waitFor(() => expect(fetchMock).not.toHaveBeenCalled()); expect(requestedUrls().filter((url) => url.includes("/guardrails/usage"))).toEqual([]); }, ); diff --git a/ui/litellm-dashboard/src/app/(dashboard)/memory/page.integration.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/memory/page.integration.test.tsx index 8d15bb59187..d93e9409f70 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/memory/page.integration.test.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/memory/page.integration.test.tsx @@ -46,7 +46,6 @@ describe("Memory page access by role", () => { renderAs(userRole); expect(await screen.findByText("Memory is only available to admin users.")).toBeInTheDocument(); - await waitFor(() => expect(fetchMock).not.toHaveBeenCalled()); expect(requestedUrls().filter((url) => url.includes("/v1/memory"))).toEqual([]); }, ); diff --git a/ui/litellm-dashboard/src/app/(dashboard)/workflows/page.integration.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/workflows/page.integration.test.tsx index 6b332faf704..4a81c0770c3 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/workflows/page.integration.test.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/workflows/page.integration.test.tsx @@ -46,7 +46,6 @@ describe("Workflows page access by role", () => { renderAs(userRole); expect(await screen.findByText("Workflow Runs is only available to admin users.")).toBeInTheDocument(); - await waitFor(() => expect(fetchMock).not.toHaveBeenCalled()); expect(requestedUrls().filter((url) => url.includes("/v1/workflows"))).toEqual([]); }, );