Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

1.2 KB
Raw Blame
use super::*;

#[test]
#[allow(
    deprecated,
    reason = "The route contract still requires the v21 ChannelMessage projection"
)]
fn route_compat_message_preserves_legacy_addressing_and_sender_metadata() {
    let mut message = inbound(
        "message-1".to_string(),
        "sender-1".to_string(),
        "conversation-1".to_string(),
        "/status".to_string(),
        "telegram".to_string(),
        Some("thread-1".into()),
    );
    message.timestamp_unix_ms = Some(123);
    message.reply_to_id = Some("reply-1".into());
    message.conversation.topic_id = Some("topic-1".into());
    message.sender.name = Some("Alice".into());

    let legacy = super::super::route_compat_message(&message);
    assert_eq!(legacy.id, "message-1");
    assert_eq!(legacy.sender, "sender-1");
    assert_eq!(legacy.reply_target, "conversation-1");
    assert_eq!(legacy.content, "/status");
    assert_eq!(legacy.channel, "telegram");
    assert_eq!(legacy.timestamp, 123);
    assert_eq!(legacy.thread_ts.as_deref(), Some("thread-1"));
    assert_eq!(legacy.reply_to_id.as_deref(), Some("reply-1"));
    assert_eq!(legacy.topic_id.as_deref(), Some("topic-1"));
    assert_eq!(legacy.sender_name.as_deref(), Some("Alice"));
}