storkit: merge 421_story_timer_command_for_deferred_agent_start
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
//! 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:?}"
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user