MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / is_idempotent_and_syncs_changes

Function is_idempotent_and_syncs_changes

atomic-agent/src/hooks/manifest.rs:425–446  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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() {

Callers

nothing calls this directly

Calls 5

writeFunction · 0.85
manifest_jsonFunction · 0.85
install_from_manifestFunction · 0.85
unwrapMethod · 0.45
pathMethod · 0.45

Tested by

no test coverage detected