Skip to content

Commit 7e92618

Browse files
committed
fix: update mock MCP server configuration in tests
- Add status: 'connected' to mock MCP server - Add proper config object with transport details - Update test snapshots to reflect connected MCP server state - Fixes failing tests after MCP server filtering implementation
1 parent 1aa8274 commit 7e92618

File tree

4 files changed

+62
-4
lines changed

4 files changed

+62
-4
lines changed

src/core/prompts/__tests__/__snapshots__/add-custom-instructions/mcp-server-creation-enabled.snap

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/core/prompts/__tests__/__snapshots__/system-prompt/with-mcp-hub-provided.snap

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/core/prompts/__tests__/add-custom-instructions.spec.ts

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,36 @@ const mockContext = {
170170
// Instead of extending McpHub, create a mock that implements just what we need
171171
const createMockMcpHub = (withServers: boolean = false): McpHub =>
172172
({
173-
getServers: () => (withServers ? [{ name: "test-server", disabled: false }] : []),
173+
getServers: () =>
174+
withServers
175+
? [
176+
{
177+
name: "test-server",
178+
disabled: false,
179+
status: "connected",
180+
config: JSON.stringify({ command: "test-command" }),
181+
tools: [],
182+
resourceTemplates: [],
183+
resources: [],
184+
instructions: undefined,
185+
},
186+
]
187+
: [],
188+
getAllServers: () =>
189+
withServers
190+
? [
191+
{
192+
name: "test-server",
193+
disabled: false,
194+
status: "connected",
195+
config: JSON.stringify({ command: "test-command" }),
196+
tools: [],
197+
resourceTemplates: [],
198+
resources: [],
199+
instructions: undefined,
200+
},
201+
]
202+
: [],
174203
getMcpServersPath: async () => "/mock/mcp/path",
175204
getMcpSettingsFilePath: async () => "/mock/settings/path",
176205
dispose: async () => {},

src/core/prompts/__tests__/system-prompt.spec.ts

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,36 @@ const mockContext = {
170170
// Instead of extending McpHub, create a mock that implements just what we need
171171
const createMockMcpHub = (withServers: boolean = false): McpHub =>
172172
({
173-
getServers: () => (withServers ? [{ name: "test-server", disabled: false }] : []),
173+
getServers: () =>
174+
withServers
175+
? [
176+
{
177+
name: "test-server",
178+
disabled: false,
179+
status: "connected",
180+
config: JSON.stringify({ command: "test-command" }),
181+
tools: [],
182+
resourceTemplates: [],
183+
resources: [],
184+
instructions: undefined,
185+
},
186+
]
187+
: [],
188+
getAllServers: () =>
189+
withServers
190+
? [
191+
{
192+
name: "test-server",
193+
disabled: false,
194+
status: "connected",
195+
config: JSON.stringify({ command: "test-command" }),
196+
tools: [],
197+
resourceTemplates: [],
198+
resources: [],
199+
instructions: undefined,
200+
},
201+
]
202+
: [],
174203
getMcpServersPath: async () => "/mock/mcp/path",
175204
getMcpSettingsFilePath: async () => "/mock/settings/path",
176205
dispose: async () => {},

0 commit comments

Comments
 (0)