#![allow(
clippy::missing_docs_in_private_items,
reason = "test helpers and fixtures do not need doc comments"
)]
use super::*;
#[test]
fn build_routine_command_does_not_duplicate_scheduled_trigger_evidence() {
let routine = make_routine("Cmd Scheduled Stamp Routine");
let agent = AgentCommand {
command: "claude".to_string(),
args: vec![],
instructions_file: "CLAUDE.md".to_string(),
setup: None,
};
let cmd = build_routine_command(&routine, &agent, TriggerSource::Scheduled);
let log = crate::paths::routine_scheduled_log_path(&slugify(&routine.title))
.to_string_lossy()
.into_owned();
assert!(
!cmd.contains(&log),
"trigger service, not launcher, must record the scheduled fire: {cmd}"
);
}
#[test]
fn build_routine_command_manual_omits_scheduled_trigger_stamp() {
let routine = make_routine("Cmd Manual No Stamp Routine");
let agent = AgentCommand {
command: "claude".to_string(),
args: vec![],
instructions_file: "CLAUDE.md".to_string(),
setup: None,
};
let cmd = build_routine_command(&routine, &agent, TriggerSource::Manual);
let log = crate::paths::routine_scheduled_log_path(&slugify(&routine.title))
.to_string_lossy()
.into_owned();
assert!(
!cmd.contains(&log),
"manual trigger must not reference the scheduled-log path: {cmd}"
);
assert!(
!cmd.contains(r#""$TS" >> "#),
"manual trigger must not append the scheduled-trigger log: {cmd}"
);
assert!(
cmd.contains("tmux new-session"),
"agent must still launch: {cmd}"
);
}