| 913 | |
| 914 | #[test] |
| 915 | fn test_enable_force_reinstall() { |
| 916 | let dir = tempfile::TempDir::new().unwrap(); |
| 917 | std::fs::create_dir_all(dir.path().join(".atomic")).unwrap(); |
| 918 | std::fs::create_dir_all(dir.path().join(".claude")).unwrap(); |
| 919 | |
| 920 | let registry = AgentRegistry::with_defaults(); |
| 921 | let agent = registry.get("claude-code").unwrap(); |
| 922 | |
| 923 | // First install |
| 924 | let count1 = agent.install(dir.path()).unwrap(); |
| 925 | assert_eq!(count1, 8); |
| 926 | |
| 927 | // Second install without force — should be 0 |
| 928 | let count2 = agent.install(dir.path()).unwrap(); |
| 929 | assert_eq!(count2, 0); |
| 930 | |
| 931 | // Uninstall and reinstall (simulating --force) |
| 932 | agent.uninstall(dir.path()).unwrap(); |
| 933 | assert!(!agent.is_installed(dir.path())); |
| 934 | |
| 935 | let count3 = agent.install(dir.path()).unwrap(); |
| 936 | assert_eq!(count3, 8); |
| 937 | assert!(agent.is_installed(dir.path())); |
| 938 | } |
| 939 | |
| 940 | #[test] |
| 941 | fn test_receipt_managed_codex_repair_uses_recorded_target() { |