litellm/ui
Cursor Agent b0a8caad57
test(ui): mock useCan so cost-optimization tests don't need a QueryClientProvider
The Cost Optimization view and UsageTab started calling useCan after
255d65192e, which pulls in useIsOrgAdmin -> useOrganizations -> useQuery.
Their unit tests render outside a QueryClientProvider, so every case blew
up with 'No QueryClient set'. Mock useCan directly, wired to the real
hasCapability so the role gating still exercises production logic.

The three page integration tests (guardrails-monitor, memory, workflows)
do run under a QueryClientProvider, so useCan fires an /organization/list
fetch that tripped the loose 'fetchMock not toHaveBeenCalled' assertion.
Narrow those to check only that the specific admin-only endpoint stays
unfetched, which is what the gate actually promises.

Co-authored-by: Krrish Dholakia <krrish-berri-2@users.noreply.github.com>
2026-08-11 07:22:44 +00:00
..
litellm-dashboard test(ui): mock useCan so cost-optimization tests don't need a QueryClientProvider 2026-08-11 07:22:44 +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