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.2 KB
Raw Blame
use super::ChannelLabelsScope;
use macro_user_id::user_id::MacroUserIdStr;
use uuid::Uuid;

#[test]
fn shared_labels_accept_only_channels_owned_by_their_team() {
    let team_id = Uuid::now_v7();
    let scope = ChannelLabelsScope::Team(team_id);

    assert!(scope.can_label_channel("team", Some(team_id)));
    assert!(!scope.can_label_channel("team", Some(Uuid::now_v7())));
    assert!(!scope.can_label_channel("direct_message", None));
}

#[test]
fn private_labels_accept_team_channels_and_reject_direct_messages() {
    let user_id = MacroUserIdStr::try_from("macro|[email protected]".to_owned()).unwrap();
    let scope = ChannelLabelsScope::User(user_id);

    assert!(scope.can_label_channel("team", Some(Uuid::now_v7())));
    assert!(!scope.can_label_channel("direct_message", None));
}

#[test]
fn personal_scope_accepts_visible_channel_types_except_dms() {
    let user = MacroUserIdStr::try_from("macro|[email protected]".to_owned()).unwrap();
    let scope = ChannelLabelsScope::User(user);
    for channel_type in ["team", "public", "private"] {
        assert!(scope.can_label_channel(channel_type, None));
    }
    assert!(!scope.can_label_channel("direct_message", None));
}