| 528 | |
| 529 | #[test] |
| 530 | fn test_enable_force_reinstall() { |
| 531 | let dir = tempfile::TempDir::new().unwrap(); |
| 532 | std::fs::create_dir_all(dir.path().join(".atomic")).unwrap(); |
| 533 | std::fs::create_dir_all(dir.path().join(".claude")).unwrap(); |
| 534 | |
| 535 | let registry = AgentRegistry::with_defaults(); |
| 536 | let agent = registry.get("claude-code").unwrap(); |
| 537 | |
| 538 | // First install |
| 539 | let count1 = agent.install(dir.path()).unwrap(); |
| 540 | assert_eq!(count1, 8); |
| 541 | |
| 542 | // Second install without force — should be 0 |
| 543 | let count2 = agent.install(dir.path()).unwrap(); |
| 544 | assert_eq!(count2, 0); |
| 545 | |
| 546 | // Uninstall and reinstall (simulating --force) |
| 547 | agent.uninstall(dir.path()).unwrap(); |
| 548 | assert!(!agent.is_installed(dir.path())); |
| 549 | |
| 550 | let count3 = agent.install(dir.path()).unwrap(); |
| 551 | assert_eq!(count3, 8); |
| 552 | assert!(agent.is_installed(dir.path())); |
| 553 | } |
| 554 | } |