feat: centralize default constants and refactor overlay enter handling in TUI

This commit is contained in:
asepharyana
2026-07-21 07:00:15 +07:00
parent 8c58faf292
commit d615090dcd
34 changed files with 216 additions and 359 deletions
+25
View File
@@ -130,3 +130,28 @@ pub fn spawn_agent_turn(state: &mut AppStateRest, text: String) {
let _ = turn_service.run_turn(params).await;
});
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_spawn_agent_turn_with_tokio_runtime() {
let rt = tokio::runtime::Runtime::new().unwrap();
let _guard = rt.enter();
let temp_dir = std::env::temp_dir().join(format!("zesdex_test_{}", uuid::Uuid::new_v4()));
let session_dir = temp_dir.join("session");
let memory_dir = temp_dir.join("memory");
std::fs::create_dir_all(&session_dir).unwrap();
std::fs::create_dir_all(&memory_dir).unwrap();
let workspace_roots = vec![temp_dir.clone()];
let mut state = AppStateRest::new(workspace_roots, &session_dir, memory_dir);
spawn_agent_turn(&mut state, "hello".to_string());
assert!(state.turn_in_flight());
let _ = std::fs::remove_dir_all(&temp_dir);
}
}