From 55ba30aa1824bfff2b8872852c7a0de48d1f3166 Mon Sep 17 00:00:00 2001 From: damocles Date: Tue, 16 Jun 2026 11:03:53 +0200 Subject: [PATCH] hive-matrix-mcp: cover send_redact reason=None in round-trip test (argus note) --- hive-matrix-mcp/src/protocol.rs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/hive-matrix-mcp/src/protocol.rs b/hive-matrix-mcp/src/protocol.rs index bf098e6a..16bbee20 100644 --- a/hive-matrix-mcp/src/protocol.rs +++ b/hive-matrix-mcp/src/protocol.rs @@ -280,7 +280,7 @@ mod tests { } #[test] - fn send_redact_round_trips_with_optional_reason() { + fn send_redact_round_trips_with_reason() { let req = DaemonRequest { account: None, op: DaemonOp::SendRedact { @@ -306,6 +306,24 @@ mod tests { } } + #[test] + fn send_redact_round_trips_without_reason() { + let req = DaemonRequest { + account: None, + op: DaemonOp::SendRedact { + room: "!r:s".to_owned(), + event_id: "$e".to_owned(), + reason: None, + }, + }; + let line = serde_json::to_string(&req).unwrap(); + let back: DaemonRequest = serde_json::from_str(&line).unwrap(); + match back.op { + DaemonOp::SendRedact { reason, .. } => assert_eq!(reason, None), + other => panic!("wrong variant: {other:?}"), + } + } + #[test] fn unit_variant_op_parses_inside_envelope() { // A bare op with no fields still parses when wrapped.