Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fixing tests

yuneng-jiangc8ce098b65d9
diff --git a/ui/litellm-dashboard/src/components/UsagePage/components/EntityUsage/EntityUsage.tsx b/ui/litellm-dashboard/src/components/UsagePage/components/EntityUsage/EntityUsage.tsx
index 5129db0a010..92d9c25c6be 100644
--- a/ui/litellm-dashboard/src/components/UsagePage/components/EntityUsage/EntityUsage.tsx
+++ b/ui/litellm-dashboard/src/components/UsagePage/components/EntityUsage/EntityUsage.tsx
@@ -465,7 +465,7 @@ const EntityUsage: React.FC<EntityUsageProps> = ({ accessToken, entityType, enti
<TabList variant="solid" className="mt-1">
<Tab>Cost</Tab>
<Tab>{entityType === "agent" ? "Request / Token Consumption" : "Model Activity"}</Tab>
- {entityType === "team" ? <Tab>Agent Activity</Tab> : null}
+ {entityType === "team" ? <Tab>Agent Activity</Tab> : <></>}
<Tab>Key Activity</Tab>
<Tab>Endpoint Activity</Tab>
</TabList>
@@ -768,11 +768,11 @@ const EntityUsage: React.FC<EntityUsageProps> = ({ accessToken, entityType, enti
<TabPanel>
<ActivityMetrics modelMetrics={modelMetrics} hidePromptCachingMetrics={entityType === "agent"} />
</TabPanel>
- {entityType === "team" && (
+ {entityType === "team" ? (
<TabPanel>
<ActivityMetrics modelMetrics={agentMetrics} />
</TabPanel>
- )}
+ ) : <></>}
<TabPanel>
<ActivityMetrics modelMetrics={keyMetrics} hidePromptCachingMetrics={entityType === "agent"} />
</TabPanel>
diff --git a/ui/litellm-dashboard/src/components/mcp_server_management/MCPToolPermissions.test.tsx b/ui/litellm-dashboard/src/components/mcp_server_management/MCPToolPermissions.test.tsx
index 5b8611f4e99..42ecdd6fd9b 100644
--- a/ui/litellm-dashboard/src/components/mcp_server_management/MCPToolPermissions.test.tsx
+++ b/ui/litellm-dashboard/src/components/mcp_server_management/MCPToolPermissions.test.tsx
@@ -19,7 +19,8 @@ describe("MCPToolPermissions", () => {
it("should update tool permissions when user selects a tool", async () => {
/**
* Tests that clicking a tool checkbox calls onChange with updated permissions.
- * This is the core functionality of the component.
+ * Pre-populates toolPermissions so the auto-populate logic on fetch is skipped,
+ * and switches to flat view for predictable checkbox ordering.
*/
const mockOnChange = vi.fn();
const mockTools = [
@@ -43,11 +44,12 @@ describe("MCPToolPermissions", () => {
error: false,
});
+ // Pre-populate with all tools selected so auto-populate doesn't fire
renderWithProviders(
<MCPToolPermissions
accessToken={mockAccessToken}
selectedServers={[mockServerId]}
- toolPermissions={{}}
+ toolPermissions={{ [mockServerId]: ["read_wiki_structure", "read_wiki_contents", "ask_question"] }}
onChange={mockOnChange}
/>,
);
@@ -61,13 +63,17 @@ describe("MCPToolPermissions", () => {
expect(screen.getByText("read_wiki_structure")).toBeInTheDocument();
});
- // Get all checkboxes and click the first one (for read_wiki_structure)
+ // Switch to Flat List view for predictable checkbox ordering
+ const flatListOption = screen.getByText("Flat List");
+ await userEvent.click(flatListOption);
+
+ // Click the first checkbox to deselect read_wiki_structure
const checkboxes = screen.getAllByRole("checkbox");
await userEvent.click(checkboxes[0]);
- // Verify onChange was called with correct permissions
+ // Verify onChange was called with read_wiki_structure removed
expect(mockOnChange).toHaveBeenCalledWith({
- [mockServerId]: ["read_wiki_structure"],
+ [mockServerId]: ["read_wiki_contents", "ask_question"],
});
// Verify API calls