Merge pull request #23098 from BerriAI/litellm_org_admin_team_fix

[Fix] UI - Agents: fix stale test assertions after AgentsPanel table refactor
This commit is contained in:
yuneng-jiang 2026-03-07 23:51:04 -08:00 committed by GitHub
commit 160e2d9642
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -20,6 +20,8 @@ vi.mock("./agents/agent_card_grid", () => ({
),
}));
// Note: agents.tsx no longer uses AgentCardGrid — it renders a Table directly.
vi.mock("./agents/agent_info", () => ({
default: () => <div data-testid="agent-info" />,
}));
@ -54,19 +56,19 @@ describe("AgentsPanel", () => {
expect(screen.queryByText("+ Add New Agent")).not.toBeInTheDocument();
});
it("should pass isAdmin=true to AgentCardGrid for admin role", async () => {
it("should show Actions column header for admin role", async () => {
render(<AgentsPanel accessToken="test-token" userRole="Admin" />);
await waitFor(() => {
const grid = screen.getByTestId("agent-card-grid");
expect(grid).toHaveAttribute("data-is-admin", "true");
expect(screen.getByRole("columnheader", { name: /actions/i })).toBeInTheDocument();
});
});
it("should pass isAdmin=false to AgentCardGrid for internal user role", async () => {
it("should not show Actions column header for internal user role", async () => {
render(<AgentsPanel accessToken="test-token" userRole="Internal User" />);
await waitFor(() => {
const grid = screen.getByTestId("agent-card-grid");
expect(grid).toHaveAttribute("data-is-admin", "false");
expect(screen.queryByRole("columnheader", { name: /actions/i })).not.toBeInTheDocument();
// confirm table is rendered (not still loading)
expect(screen.getByRole("table")).toBeInTheDocument();
});
});