| 681 | |
| 682 | #[test] |
| 683 | fn test_enable_force_reinstall() { |
| 684 | let dir = tempfile::TempDir::new().unwrap(); |
| 685 | std::fs::create_dir_all(dir.path().join(".atomic")).unwrap(); |
| 686 | std::fs::create_dir_all(dir.path().join(".claude")).unwrap(); |
| 687 | |
| 688 | let registry = AgentRegistry::with_defaults(); |
| 689 | let agent = registry.get("claude-code").unwrap(); |
| 690 | |
| 691 | // First install |
| 692 | let count1 = agent.install(dir.path()).unwrap(); |
| 693 | assert_eq!(count1, 8); |
| 694 | |
| 695 | // Second install without force — should be 0 |
| 696 | let count2 = agent.install(dir.path()).unwrap(); |
| 697 | assert_eq!(count2, 0); |
| 698 | |
| 699 | // Uninstall and reinstall (simulating --force) |
| 700 | agent.uninstall(dir.path()).unwrap(); |
| 701 | assert!(!agent.is_installed(dir.path())); |
| 702 | |
| 703 | let count3 = agent.install(dir.path()).unwrap(); |
| 704 | assert_eq!(count3, 8); |
| 705 | assert!(agent.is_installed(dir.path())); |
| 706 | } |
| 707 | } |