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:
ryan-crabbe-berri 2026-08-11 12:31:43 -07:00 committed by GitHub
parent 953bcad706
commit 65fbeb5531
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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),
}));