mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-12 23:01:41 +00:00
fix(ui): stub useIsOrgAdmin in role-gated admin page integration tests
The three admin-only page integration tests (guardrails-monitor, memory, workflows) assert that fetchMock is never called for non-admin roles. useIsOrgAdmin fires a GET /organization/list request under the hood, so that expectation fails once the hook mounts. Stub the hook to false to keep the network boundary silent for non-admin roles. Co-authored-by: Krrish Dholakia <krrish-berri-2@users.noreply.github.com>
This commit is contained in:
parent
bea31871fc
commit
9b262c06eb
3 changed files with 12 additions and 0 deletions
|
|
@ -9,6 +9,10 @@ vi.mock("@/app/(dashboard)/hooks/useAuthorized", () => ({
|
|||
default: useAuthorizedMock,
|
||||
}));
|
||||
|
||||
vi.mock("@/app/(dashboard)/hooks/useIsOrgAdmin", () => ({
|
||||
default: () => false,
|
||||
}));
|
||||
|
||||
const fetchMock = vi.fn();
|
||||
|
||||
const requestedUrls = () => fetchMock.mock.calls.map(([url]) => String(url));
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@ vi.mock("@/app/(dashboard)/hooks/useAuthorized", () => ({
|
|||
default: useAuthorizedMock,
|
||||
}));
|
||||
|
||||
vi.mock("@/app/(dashboard)/hooks/useIsOrgAdmin", () => ({
|
||||
default: () => false,
|
||||
}));
|
||||
|
||||
const fetchMock = vi.fn();
|
||||
|
||||
const requestedUrls = () => fetchMock.mock.calls.map(([url]) => String(url));
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@ vi.mock("@/app/(dashboard)/hooks/useAuthorized", () => ({
|
|||
default: useAuthorizedMock,
|
||||
}));
|
||||
|
||||
vi.mock("@/app/(dashboard)/hooks/useIsOrgAdmin", () => ({
|
||||
default: () => false,
|
||||
}));
|
||||
|
||||
const fetchMock = vi.fn();
|
||||
|
||||
const requestedUrls = () => fetchMock.mock.calls.map(([url]) => String(url));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue