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:
Cursor Agent 2026-08-12 00:05:50 +00:00
parent bea31871fc
commit 9b262c06eb
No known key found for this signature in database
3 changed files with 12 additions and 0 deletions

View file

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

View file

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

View file

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