| 684 | |
| 685 | #[tokio::test] |
| 686 | async fn test_file_store_load_partial_json() { |
| 687 | let dir = tempdir().unwrap(); |
| 688 | let store = FileSessionStore::new(dir.path()).await.unwrap(); |
| 689 | |
| 690 | // Truncated JSON — simulates a crash mid-write |
| 691 | let partial_path = dir.path().join("partial-session.json"); |
| 692 | tokio::fs::write(&partial_path, b"{\"id\":\"partial-session\",\"message") |
| 693 | .await |
| 694 | .unwrap(); |
| 695 | |
| 696 | let result = store.load("partial-session").await; |
| 697 | assert!(result.is_err(), "Partial JSON must return error"); |
| 698 | } |
| 699 | |
| 700 | #[tokio::test] |
| 701 | async fn test_file_store_concurrent_save() { |