Skip to content

Commit 9c2bc2a

Browse files
Copilotpatniko
andcommitted
Improve test assertion to avoid false positives
Co-authored-by: patniko <26906478+patniko@users.noreply.github.com>
1 parent ed8e06f commit 9c2bc2a

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

nodejs/test/e2e/mcp-and-agents.test.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -245,14 +245,19 @@ describe("MCP Servers and Custom Agents", async () => {
245245
expect(message?.data.content).toBeDefined();
246246
const content = message!.data.content || "";
247247

248-
// Check that the custom agent is mentioned (either by name or in the list)
249-
// The CLI should include custom agents in the task tool description
250-
expect(
251-
content.toLowerCase().includes("test-agent") ||
252-
content.toLowerCase().includes("test agent") ||
253-
content.toLowerCase().includes("user-defined") ||
254-
content.toLowerCase().includes("user-provided")
255-
).toBe(true);
248+
// Check that the custom agent name is mentioned AND
249+
// that it's mentioned in a positive context (available/configured)
250+
// This ensures the agent is actually surfaced, not just mentioned as missing
251+
const lowerContent = content.toLowerCase();
252+
const hasAgentName = lowerContent.includes("test-agent") || lowerContent.includes("test agent");
253+
const hasPositiveIndicator =
254+
lowerContent.includes("available") ||
255+
lowerContent.includes("configured") ||
256+
lowerContent.includes("following") ||
257+
lowerContent.includes("include");
258+
259+
expect(hasAgentName).toBe(true);
260+
expect(hasPositiveIndicator).toBe(true);
256261

257262
await session.destroy();
258263
});

0 commit comments

Comments
 (0)