| 329 | |
| 330 | #[test] |
| 331 | fn test_disable_roundtrip() { |
| 332 | let dir = tempfile::TempDir::new().unwrap(); |
| 333 | std::fs::create_dir_all(dir.path().join(".atomic")).unwrap(); |
| 334 | std::fs::create_dir_all(dir.path().join(".claude")).unwrap(); |
| 335 | |
| 336 | let registry = AgentRegistry::with_defaults(); |
| 337 | let agent = registry.get("claude-code").unwrap(); |
| 338 | |
| 339 | // Install hooks first |
| 340 | let count = agent.install(dir.path()).unwrap(); |
| 341 | assert_eq!(count, 8); |
| 342 | assert!(agent.is_installed(dir.path())); |
| 343 | |
| 344 | // Uninstall |
| 345 | agent.uninstall(dir.path()).unwrap(); |
| 346 | assert!(!agent.is_installed(dir.path())); |
| 347 | |
| 348 | // Settings file should still exist (with non-Atomic content or empty hooks) |
| 349 | let settings_path = dir.path().join(".claude").join("settings.json"); |
| 350 | assert!(settings_path.exists()); |
| 351 | |
| 352 | // Verify no Atomic hooks remain |
| 353 | let content = std::fs::read_to_string(&settings_path).unwrap(); |
| 354 | assert!(!content.contains("atomic agent hooks")); |
| 355 | } |
| 356 | |
| 357 | #[test] |
| 358 | fn test_disable_preserves_non_atomic_hooks() { |