2026-03-24 15:03:17 +00:00
|
|
|
//! Handler stub for the `assign` command.
|
2026-03-22 19:07:07 +00:00
|
|
|
//!
|
2026-03-24 17:54:51 +00:00
|
|
|
//! The real implementation lives in `crate::chat::transport::matrix::assign` (async). This
|
2026-03-24 15:03:17 +00:00
|
|
|
//! 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`.
|
2026-03-22 19:07:07 +00:00
|
|
|
|
|
|
|
|
use super::CommandContext;
|
|
|
|
|
|
2026-03-24 15:03:17 +00:00
|
|
|
pub(super) fn handle_assign(_ctx: &CommandContext) -> Option<String> {
|
2026-03-24 17:54:51 +00:00
|
|
|
// Handled asynchronously in bot.rs / crate::chat::transport::matrix::assign.
|
2026-03-24 15:03:17 +00:00
|
|
|
None
|
2026-03-22 19:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
// 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]
|
2026-03-24 15:03:17 +00:00
|
|
|
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",
|
2026-03-22 19:07:07 +00:00
|
|
|
);
|
|
|
|
|
assert!(
|
2026-03-24 15:03:17 +00:00
|
|
|
result.is_none(),
|
|
|
|
|
"assign should not produce a sync response (handled async): {result:?}"
|
2026-03-22 19:07:07 +00:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|