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

Function test_save_and_load

atomic-agent/src/provenance/accumulator/tests.rs:729–748  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

727
728#[test]
729fn test_save_and_load() {
730 let dir = tempfile::tempdir().unwrap();
731 let session_dir = dir.path().join("test-session");
732
733 let mut acc = ProvenanceAccumulator::new("test-session");
734 acc.append_goal("Fix bug", 1000);
735 acc.append_tool_call("read", Some("c1"), None, None, None, None, 1001);
736 acc.append_tool_call("edit", Some("c2"), None, None, None, None, 1002);
737
738 acc.save(&session_dir).unwrap();
739
740 // Verify file exists
741 assert!(session_dir.join(GRAPH_FILENAME).exists());
742
743 // Load it back
744 let restored = ProvenanceAccumulator::load_or_create(&session_dir, "test-session").unwrap();
745 assert_eq!(restored.node_count(), 3);
746 assert_eq!(restored.edge_count(), acc.edge_count());
747 assert_eq!(restored.session_id(), "test-session");
748}
749
750#[test]
751fn test_load_nonexistent_creates_empty() {

Callers

nothing calls this directly

Calls 5

append_goalMethod · 0.80
append_tool_callMethod · 0.80
unwrapMethod · 0.45
pathMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected