| 577 | |
| 578 | #[test] |
| 579 | fn test_enable_force_reinstall() { |
| 580 | let dir = tempfile::TempDir::new().unwrap(); |
| 581 | std::fs::create_dir_all(dir.path().join(".atomic")).unwrap(); |
| 582 | std::fs::create_dir_all(dir.path().join(".claude")).unwrap(); |
| 583 | |
| 584 | let registry = AgentRegistry::with_defaults(); |
| 585 | let agent = registry.get("claude-code").unwrap(); |
| 586 | |
| 587 | // First install |
| 588 | let count1 = agent.install(dir.path()).unwrap(); |
| 589 | assert_eq!(count1, 8); |
| 590 | |
| 591 | // Second install without force — should be 0 |
| 592 | let count2 = agent.install(dir.path()).unwrap(); |
| 593 | assert_eq!(count2, 0); |
| 594 | |
| 595 | // Uninstall and reinstall (simulating --force) |
| 596 | agent.uninstall(dir.path()).unwrap(); |
| 597 | assert!(!agent.is_installed(dir.path())); |
| 598 | |
| 599 | let count3 = agent.install(dir.path()).unwrap(); |
| 600 | assert_eq!(count3, 8); |
| 601 | assert!(agent.is_installed(dir.path())); |
| 602 | } |
| 603 | } |