use jspg::database::executor::DatabaseExecutor; use serde_json::Value; use std::sync::Mutex; pub struct MockExecutor { pub query_responses: Mutex>>, pub execute_responses: Mutex>>, } impl MockExecutor { pub fn new() -> Self { Self { query_responses: Mutex::new(Vec::new()), execute_responses: Mutex::new(Vec::new()), } } } impl DatabaseExecutor for MockExecutor { fn query(&self, _sql: &str, _args: Option<&[Value]>) -> Result { let mut responses = self.query_responses.lock().unwrap(); if responses.is_empty() { return Ok(Value::Array(vec![])); } responses.remove(0) } fn execute(&self, _sql: &str, _args: Option<&[Value]>) -> Result<(), String> { let mut responses = self.execute_responses.lock().unwrap(); if responses.is_empty() { return Ok(()); } responses.remove(0) } fn auth_user_id(&self) -> Result { Ok("00000000-0000-0000-0000-000000000000".to_string()) } fn timestamp(&self) -> Result { Ok("2026-03-10T00:00:00Z".to_string()) } }