Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

1.3 KB
Raw Blame
use super::*;

#[test]
fn direct_message_falls_back_to_the_other_participants_email_local_part() {
    let participants = vec![
        "macro|[email protected]".to_string(),
        "macro|[email protected]".to_string(),
    ];

    let name = resolve_channel_name(
        ChannelType::DirectMessage,
        None,
        Uuid::nil(),
        "macro|[email protected]",
        &participants,
        &NameLookup::new(),
        &HashMap::new(),
    );

    assert_eq!(name, "shepherd.hatton");
}

#[test]
fn unnamed_private_channel_lists_people_and_bots_but_not_the_viewer() {
    let participants = vec![
        "macro|[email protected]".to_string(),
        "macro|[email protected]".to_string(),
        format!("bot|{}", bot_id::CODEX_BOT_ID),
    ];
    let mut user_names = NameLookup::new();
    user_names.insert(
        MacroUserIdStr::try_from("macro|[email protected]".to_string()).unwrap(),
        "Gabriel Birman".to_string(),
    );
    let bot_names = HashMap::from([(bot_id::CODEX_BOT_ID, "Codex".to_string())]);

    let name = resolve_channel_name(
        ChannelType::Private,
        Some("  "),
        Uuid::nil(),
        "macro|[email protected]",
        &participants,
        &user_names,
        &bot_names,
    );

    assert_eq!(name, "Codex, Gabriel Birman");
}