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.