litellm/ui
Cursor Agent bd2d334c10
test(ui): mock useCan so cost-optimization tests don't need a QueryClientProvider
The recent capability-gating pass added useCan calls to UsageTab.tsx,
CostOptimizationView.tsx, and the three new admin-only page.tsx files.
useCan reaches useIsOrgAdmin -> useOrganizations -> useQuery, so every
render now needs a QueryClientProvider or the tree throws "No QueryClient
set" and the /organization/list fetch is a legitimate side effect.

Mock useCan in the three unit tests, wired to the real hasCapability so
per-role behaviour still runs end-to-end. Narrow the three page
integration tests' loose "fetchMock was never called" assertion to the
specific admin-only endpoint each page owns; the org fetch was tripping
it after the capability check landed.

Co-authored-by: Krrish Dholakia <krrish-berri-2@users.noreply.github.com>
2026-08-11 01:29:14 +00:00
..
litellm-dashboard test(ui): mock useCan so cost-optimization tests don't need a QueryClientProvider 2026-08-11 01:29:14 +00:00
Dockerfile chore(build): move the Admin UI toolchain to Node 24 (#35801) 2026-08-04 12:36:07 -07:00
nginx.conf fix(ui): serve /ui/assets from the nginx image instead of SPA fallback (#34066) 2026-07-21 09:22:02 -07:00