test(palette): cover disabled MCP server case (#197)

Acceptance list called for tests of no-config / healthy / disabled /
failed servers. Healthy and failed already had a single dense
test (`command_palette_includes_mcp_discovery_and_failed_servers`);
no-config is implicit in the existing call sites that pass `None`
for the snapshot. Disabled was the actual gap — adds one focused
case asserting the `[disabled]` state tag appears in the rendered
description so users can see disabled servers in the palette
without opening the MCP manager.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Hunter Bown
2026-05-01 02:36:56 -05:00
parent 1089bd3447
commit eac8d82ab8
+44
View File
@@ -1017,6 +1017,50 @@ mod tests {
assert_eq!(use_entry.command, "mcp_fs_read");
}
#[test]
fn command_palette_marks_disabled_servers_visibly() {
// The healthy/failed cases are covered above; disabled was the
// remaining gap from #197's acceptance list. Disabled servers must
// appear in the palette with a `[disabled]` state tag so users can
// see them without opening the MCP manager.
let snapshot = crate::mcp::McpManagerSnapshot {
config_path: Path::new("mcp.json").to_path_buf(),
config_exists: true,
restart_required: false,
servers: vec![crate::mcp::McpServerSnapshot {
name: "muted".to_string(),
enabled: false,
required: false,
transport: "stdio".to_string(),
command_or_url: "node disabled.js".to_string(),
connect_timeout: 10,
execute_timeout: 60,
read_timeout: 120,
connected: false,
error: None,
tools: Vec::new(),
resources: Vec::new(),
prompts: Vec::new(),
}],
};
let entries = build_entries(
Path::new("."),
Path::new("."),
Path::new("mcp.json"),
Some(&snapshot),
);
let muted = entries
.iter()
.find(|entry| entry.label == "mcp:muted")
.expect("disabled server should still appear in the palette");
assert!(
muted.description.contains("[disabled]"),
"expected `[disabled]` state tag in description, got: {}",
muted.description
);
}
#[test]
fn command_palette_emits_actions_not_raw_insertions() {
let entries = vec![CommandPaletteEntry {