mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
fix(ui): stub useIsOrgAdmin in UsageTab tests so useCan needs no QueryClient (#36565)
255d65192e added useCan to UsageTab, whose useIsOrgAdmin leg calls
useOrganizations (react-query), so every UsageTab test died with 'No
QueryClient set'. Stub the org-admin leg; role gating still flows through
the real hasCapability with the varied userRole.
This commit is contained in:
parent
953bcad706
commit
65fbeb5531
1 changed files with 6 additions and 0 deletions
|
|
@ -13,6 +13,12 @@ vi.mock("@/app/(dashboard)/hooks/useAuthorized", () => ({
|
|||
default: useAuthorizedMock,
|
||||
}));
|
||||
|
||||
// useCan reaches useOrganizations (react-query) through useIsOrgAdmin; stub the
|
||||
// org-admin leg so role gating flows through hasCapability without a QueryClient
|
||||
vi.mock("@/app/(dashboard)/hooks/useIsOrgAdmin", () => ({
|
||||
default: () => false,
|
||||
}));
|
||||
|
||||
vi.mock("@/components/networking", () => ({
|
||||
getToolSpend: (...args: unknown[]) => mockGetToolSpend(...args),
|
||||
}));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue