From 26c66fc2dbafcff2c03d472bbf2c556aabd9ee6e Mon Sep 17 00:00:00 2001 From: Kobi Kadosh Date: Sun, 16 Aug 2026 01:37:56 -0700 Subject: [PATCH] test(mcp): preserve discovery sanitization coverage --- .../CreateMCPServer.integration.test.tsx | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/ui/litellm-dashboard/src/app/(dashboard)/mcp-servers/_components/CreateMCPServer.integration.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/mcp-servers/_components/CreateMCPServer.integration.test.tsx index 85921f02b31..e6b22e761a0 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/mcp-servers/_components/CreateMCPServer.integration.test.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/mcp-servers/_components/CreateMCPServer.integration.test.tsx @@ -1895,7 +1895,24 @@ describe("CreateMCPServer", () => { }); describe("when prefillData is provided", () => { - it("should populate form fields from discovery data", async () => { + it("should sanitize the server name from discovery data", async () => { + const prefillData = { + name: "github-mcp", + title: "GitHub MCP", + description: "GitHub integration server", + category: "Development", + transport: "http", + url: "https://github-mcp.example.com", + }; + + render(); + + await waitFor(() => { + expect(getServerNameInput()).toHaveValue("github_mcp"); + }); + }); + + it("should populate URL and auth type from discovery data", async () => { const prefillData = { name: "nimble", title: "Nimble", @@ -1909,8 +1926,7 @@ describe("CreateMCPServer", () => { render(); await waitFor(() => { - const nameInput = getServerNameInput(); - expect(nameInput).toHaveValue("nimble"); + expect(getServerNameInput()).toHaveValue("nimble"); expect(screen.getByPlaceholderText("https://your-mcp-server.com")).toHaveValue("https://mcp.nimbleway.com/mcp"); expect(screen.getByText("Bearer Token")).toBeInTheDocument(); expect(screen.getByText("Authentication Value")).toBeInTheDocument();