()
| 423 | |
| 424 | #[test] |
| 425 | fn is_idempotent_and_syncs_changes() { |
| 426 | let dir = tempfile::tempdir().unwrap(); |
| 427 | let target = dir.path().join("hooks.json"); |
| 428 | let manifest = dir.path().join("manifest.json"); |
| 429 | write( |
| 430 | &manifest, |
| 431 | &manifest_json(&target, "atomic agent hooks codex"), |
| 432 | ); |
| 433 | |
| 434 | install_from_manifest(&manifest).unwrap(); |
| 435 | // Second run removes the 2 stale entries and re-adds 2 — no duplicates. |
| 436 | let outcome = install_from_manifest(&manifest).unwrap(); |
| 437 | assert_eq!(outcome.added, 2); |
| 438 | assert_eq!(outcome.removed, 2); |
| 439 | |
| 440 | let written: Value = |
| 441 | serde_json::from_str(&std::fs::read_to_string(&target).unwrap()).unwrap(); |
| 442 | assert_eq!( |
| 443 | written["hooks"]["SessionStart"].as_array().unwrap().len(), |
| 444 | 1 |
| 445 | ); |
| 446 | } |
| 447 | |
| 448 | #[test] |
| 449 | fn preserves_non_atomic_hooks() { |
nothing calls this directly
no test coverage detected