#![allow(
clippy::missing_docs_in_private_items,
reason = "test helpers and fixtures do not need doc comments"
)]
use super::MoadimMcp;
fn make_handler() -> MoadimMcp {
MoadimMcp::new(
crate::routines::new_store(),
crate::paths::routines_dir(),
0,
std::sync::Arc::new(tokio::sync::Notify::new()),
)
}
fn make_create_routine_req() -> crate::routines::CreateRoutineRequest {
crate::routines::CreateRoutineRequest {
model: None,
schedule: "@daily".into(),
title: "Mcp Routine".into(),
agent: "claude".into(),
prompt: "p".into(),
goal: None,
repositories: vec![],
machines: vec![crate::machine::current_machine()],
enabled: true,
ttl_secs: None,
max_runtime_secs: None,
tags: vec![],
env: std::collections::HashMap::new(),
}
}
#[test]
fn create_routine_tool_invalid_cron_is_error() {
use rmcp::handler::server::wrapper::Parameters;
let handler = make_handler();
let mut req = make_create_routine_req();
req.schedule = "not-a-cron".into();
let result = handler.create_routine(Parameters(req)).unwrap();
assert!(result.is_error.unwrap_or(false));
}