use pretty_assertions::assert_eq;
use super::*;
#[test]
fn writes_the_allowlist_where_agy_discovers_agents() {
let run_dir = tempfile::tempdir().unwrap();
let tools = [AntigravityTool::ReadFile, AntigravityTool::RunCommand];
let mut written = Vec::new();
for servers in [&[][..], &["rho"]] {
let agent = write(run_dir.path(), &tools, servers).unwrap();
let file = agent.root.join(format!(".agents/agents/{}.md", agent.name));
let text = std::fs::read_to_string(file).unwrap();
written.push((agent.root, text.replace(&agent.name, "<name>")));
}
let root = run_dir.path().join("agy");
assert_eq!(
written,
vec![
(
root.clone(),
"---\nname: <name>\ndescription: Rho delegated run.\ntools:\n - read_file\n - run_command\n---\n".to_owned()
),
(
root,
"---\nname: <name>\ndescription: Rho delegated run.\ntools:\n - read_file\n - run_command\nmcpServers:\n - rho\n---\n".to_owned()
),
]
);
let first = write(run_dir.path(), &tools, &[]).unwrap().name;
assert_ne!(write(run_dir.path(), &tools, &[]).unwrap().name, first);
}