MCPcopy Create free account
hub / github.com/AI45Lab/Code / test_file_store_corrupted_json_recovery

Function test_file_store_corrupted_json_recovery

core/src/store/tests.rs:591–604  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

589
590#[tokio::test]
591async fn test_file_store_corrupted_json_recovery() {
592 let dir = tempdir().unwrap();
593 let store = FileSessionStore::new(dir.path()).await.unwrap();
594
595 // Manually write invalid JSON to a session file
596 let corrupted_path = dir.path().join("test-id.json");
597 tokio::fs::write(&corrupted_path, b"not valid json {{{")
598 .await
599 .unwrap();
600
601 // Loading should return an error, not panic
602 let result = store.load("test-id").await;
603 assert!(result.is_err());
604}
605
606// ========================================================================
607// Exists Tests

Callers

nothing calls this directly

Calls 3

writeFunction · 0.85
pathMethod · 0.80
loadMethod · 0.45

Tested by

no test coverage detected