use std::fs;
use tempfile::TempDir;
use uuid::Uuid;
use crate::brain::agent::service::builder::AgentService;
#[tokio::test]
async fn augment_user_message_injects_time_marker() {
use crate::config::profile::with_home_override_async;
let dir = TempDir::new().unwrap();
let user_md = dir.path().join("USER.md");
fs::write(&user_md, "Timezone: UTC+3 (MSK)\n").unwrap();
let session_id = Uuid::new_v4();
let augmented = with_home_override_async(
dir.path().to_path_buf(),
AgentService::augment_user_message(session_id, "hello world", Some(dir.path())),
)
.await;
assert!(augmented.contains("[Current time:"));
assert!(augmented.contains("UTC"));
assert!(augmented.contains("MSK"));
assert!(augmented.ends_with("hello world"));
}
#[tokio::test]
async fn augment_user_message_falls_back_to_utc() {
use crate::config::profile::with_home_override_async;
let dir = TempDir::new().unwrap();
let session_id = Uuid::new_v4();
let augmented = with_home_override_async(
dir.path().to_path_buf(),
AgentService::augment_user_message(session_id, "test message", None),
)
.await;
assert!(augmented.contains("[Current time:"));
assert!(augmented.contains("UTC"));
assert!(!augmented.contains("(user:"));
assert!(augmented.ends_with("test message"));
}