()
| 727 | |
| 728 | #[test] |
| 729 | fn 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] |
| 751 | fn test_load_nonexistent_creates_empty() { |
nothing calls this directly
no test coverage detected