Files
huskies/server/src/chat/commands/timer.rs
T

55 lines
1.6 KiB
Rust

//! Handler stub for the `timer` command.
//!
//! The real implementation lives in `crate::chat::timer` (async). This
//! stub exists only so that `timer` appears in the help registry — the
//! handler always returns `None` so the bot's message loop falls through to
//! the async handler.
use super::CommandContext;
pub(super) fn handle_timer(_ctx: &CommandContext) -> Option<String> {
// Handled asynchronously in each transport's message dispatcher.
None
}
// ---------------------------------------------------------------------------
// Tests
// ---------------------------------------------------------------------------
#[cfg(test)]
mod tests {
#[test]
fn timer_command_is_registered() {
use super::super::commands;
let found = commands().iter().any(|c| c.name == "timer");
assert!(found, "timer command must be in the registry");
}
#[test]
fn timer_command_appears_in_help() {
let result = super::super::tests::try_cmd_addressed(
"Timmy",
"@timmy:homeserver.local",
"@timmy help",
);
let output = result.unwrap();
assert!(
output.contains("timer"),
"help should list timer command: {output}"
);
}
#[test]
fn timer_command_falls_through_to_none_in_registry() {
let result = super::super::tests::try_cmd_addressed(
"Timmy",
"@timmy:homeserver.local",
"@timmy timer list",
);
assert!(
result.is_none(),
"timer should not produce a sync response (handled async): {result:?}"
);
}
}