Files
buzz/desktop/src-tauri/src/migration_command_tests.rs
npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 db225c63dd fix(desktop): repair clippy and doc-comment issues from pass-3 corrections
- backfill.rs: remove blank line between two consecutive doc comment blocks
- detach.rs: merge orphaned step-list doc comment into function doc comment
- migration.rs: remove blank line after doc comment before private fn
- migration_tests.rs, migration_command_tests.rs, migration_avatar_tests.rs,
  migration_databricks_tests.rs: add .unwrap() to calls that now return
  Result after C5 migration fallibility changes

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
2026-08-03 04:30:47 -04:00

90 lines
2.9 KiB
Rust

use super::test_support::*;
use super::*;
#[test]
fn reconcile_legacy_command_names_rewrites_renamed_sidecars() {
let dir = tempfile::tempdir().unwrap();
write_agents_json(
dir.path(),
&serde_json::json!([{
"name": "Brain",
"acp_command": "sprout-acp",
"agent_command": "sprout-agent",
"mcp_command": "sprout-dev-mcp"
}]),
);
reconcile_legacy_command_names_in_file(&dir.path().join("agents/managed-agents.json")).unwrap();
let records = read_agents_json(dir.path());
assert_eq!(records[0]["acp_command"], "buzz-acp");
assert_eq!(records[0]["agent_command"], "buzz-agent");
assert_eq!(records[0]["mcp_command"], "buzz-dev-mcp");
}
#[test]
fn reconcile_legacy_command_names_updates_removed_mcp_server_for_buzz_agent() {
let dir = tempfile::tempdir().unwrap();
write_agents_json(
dir.path(),
&serde_json::json!([{
"name": "Brain",
"acp_command": "sprout-acp",
"agent_command": "sprout-agent",
"mcp_command": "sprout-mcp-server"
}]),
);
reconcile_legacy_command_names_in_file(&dir.path().join("agents/managed-agents.json")).unwrap();
let records = read_agents_json(dir.path());
assert_eq!(records[0]["acp_command"], "buzz-acp");
assert_eq!(records[0]["agent_command"], "buzz-agent");
assert_eq!(records[0]["mcp_command"], "buzz-dev-mcp");
}
#[test]
fn reconcile_legacy_command_names_clears_removed_mcp_server_for_goose() {
let dir = tempfile::tempdir().unwrap();
write_agents_json(
dir.path(),
&serde_json::json!([{
"name": "Solo",
"acp_command": "sprout-acp",
"agent_command": "goose",
"mcp_command": "sprout-mcp-server"
}]),
);
reconcile_legacy_command_names_in_file(&dir.path().join("agents/managed-agents.json")).unwrap();
let records = read_agents_json(dir.path());
assert_eq!(records[0]["acp_command"], "buzz-acp");
assert_eq!(records[0]["agent_command"], "goose");
assert_eq!(records[0]["mcp_command"], "");
}
#[test]
fn reconcile_legacy_command_names_preserves_custom_commands() {
let dir = tempfile::tempdir().unwrap();
let json = serde_json::json!([{
"name": "Custom",
"acp_command": "custom-acp",
"agent_command": "custom-agent",
"mcp_command": "custom-mcp"
}]);
write_agents_json(dir.path(), &json);
let path = dir.path().join("agents/managed-agents.json");
let before = std::fs::read_to_string(&path).unwrap();
reconcile_legacy_command_names_in_file(&path).unwrap();
assert_eq!(before, std::fs::read_to_string(&path).unwrap());
}
// Tests for `reconcile_legacy_persona_runtimes_in_file`,
// `rewrite_legacy_persona_md_runtime`, and
// `reconcile_legacy_team_persona_runtime_files` were removed alongside those
// deleted functions. The scoped pipeline's `_in_dir` variants carry the
// equivalent coverage.