MCPcopy Create free account
hub / github.com/dallay/agentsync / test_init_overwrites_with_force

Function test_init_overwrites_with_force

src/init.rs:2328–2351  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2326
2327 #[test]
2328 fn test_init_overwrites_with_force() {
2329 let temp_dir = TempDir::new().unwrap();
2330 let agents_dir = temp_dir.path().join(".agents");
2331 fs::create_dir_all(&agents_dir).unwrap();
2332
2333 // Create existing files with custom content
2334 let config_path = agents_dir.join("agentsync.toml");
2335 fs::write(&config_path, "# Old config").unwrap();
2336
2337 let agents_md_path = agents_dir.join("AGENTS.md");
2338 fs::write(&agents_md_path, "# Old agents").unwrap();
2339
2340 // Init WITH force
2341 init(temp_dir.path(), true).unwrap();
2342
2343 // Files SHOULD be overwritten with default content
2344 let config_content = fs::read_to_string(&config_path).unwrap();
2345 assert!(config_content.contains("[agents.claude]"));
2346 assert!(config_content.contains("[agents.cursor]"));
2347 assert!(config_content.contains("[agents.codex]"));
2348
2349 let agents_content = fs::read_to_string(&agents_md_path).unwrap();
2350 assert!(agents_content.contains("# AI Agent Instructions"));
2351 }
2352
2353 #[test]
2354 fn test_init_with_existing_agents_dir() {

Callers

nothing calls this directly

Calls 1

initFunction · 0.85

Tested by

no test coverage detected