Files
huskies/server/src/matrix/commands/assign.rs
T

58 lines
1.8 KiB
Rust

//! Handler stub for the `assign` command.
//!
//! The real implementation lives in `crate::matrix::assign` (async). This
//! stub exists only so that `assign` appears in the help registry — the
//! handler always returns `None` so the bot's message loop falls through to
//! the async handler in `bot.rs`.
use super::CommandContext;
pub(super) fn handle_assign(_ctx: &CommandContext) -> Option<String> {
// Handled asynchronously in bot.rs / crate::matrix::assign.
None
}
// ---------------------------------------------------------------------------
// Tests
// ---------------------------------------------------------------------------
#[cfg(test)]
mod tests {
// -- registration / help ------------------------------------------------
#[test]
fn assign_command_is_registered() {
use super::super::commands;
let found = commands().iter().any(|c| c.name == "assign");
assert!(found, "assign command must be in the registry");
}
#[test]
fn assign_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("assign"),
"help should list assign command: {output}"
);
}
#[test]
fn assign_command_falls_through_to_none_in_registry() {
// The assign handler in the registry returns None (handled async in bot.rs).
let result = super::super::tests::try_cmd_addressed(
"Timmy",
"@timmy:homeserver.local",
"@timmy assign 42 opus",
);
assert!(
result.is_none(),
"assign should not produce a sync response (handled async): {result:?}"
);
}
}