()
| 2140 | |
| 2141 | #[tokio::test(flavor = "multi_thread")] |
| 2142 | async fn test_session_save_with_history() { |
| 2143 | let store = Arc::new(crate::store::MemorySessionStore::new()); |
| 2144 | let agent = Agent::from_config(test_config()).await.unwrap(); |
| 2145 | |
| 2146 | let opts = SessionOptions::new() |
| 2147 | .with_session_store(store.clone()) |
| 2148 | .with_session_id("history-test"); |
| 2149 | let session = agent.session("/tmp/test-ws-hist", Some(opts)).unwrap(); |
| 2150 | |
| 2151 | // Manually inject history |
| 2152 | { |
| 2153 | let mut h = session.history.write().unwrap(); |
| 2154 | h.push(Message::user("Hello")); |
| 2155 | h.push(Message::user("How are you?")); |
| 2156 | } |
| 2157 | |
| 2158 | session.save().await.unwrap(); |
| 2159 | |
| 2160 | let data = store.load("history-test").await.unwrap().unwrap(); |
| 2161 | assert_eq!(data.messages.len(), 2); |
| 2162 | } |
| 2163 | |
| 2164 | #[tokio::test(flavor = "multi_thread")] |
| 2165 | async fn test_resume_session() { |
nothing calls this directly
no test coverage detected