Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
use super::*;
use crate::domain::models::{AttendeeResponseStatus, CalendarAttendee};
fn attendee(email: &str, is_self: bool) -> CalendarAttendee {
CalendarAttendee {
email: email.to_string(),
display_name: None,
response_status: AttendeeResponseStatus::NeedsAction,
is_organizer: false,
is_optional: false,
is_self,
comment: None,
}
}
fn inbox(link_id: u128, email: &str) -> OwnedInbox {
OwnedInbox {
link_id: Uuid::from_u128(link_id),
email: email.to_string(),
provider: CalendarProvider::Google,
writable_calendar_ids: Vec::new(),
}
}
#[test]
fn from_owned_empty_is_none() {
assert!(ActorInboxes::from_owned(Vec::new()).is_none());
}
#[test]
fn from_owned_does_not_add_addresses_that_were_not_supplied() {
let actor = ActorInboxes::from_owned(vec![inbox(1, "[email protected]")])
.expect("owned addresses remain after normalize");
assert!(actor.matches("[email protected]"));
assert!(!actor.matches("[email protected]"));
}
#[test]
fn actor_inboxes_dedupe_and_match_case_insensitively() {
let actor = ActorInboxes::from_owned(vec![
inbox(1, "[email protected]"),
inbox(1, "[email protected]"),
inbox(1, "[email protected]"),
])
.expect("owned addresses remain after normalize");
assert!(actor.matches("[email protected]"));
assert_eq!(actor.iter().collect::<Vec<_>>(), ["[email protected]"]);
}
#[test]
fn mark_attendees_marks_only_the_copys_inbox() {
let actor = ActorInboxes::from_owned(vec![
inbox(1, "[email protected]"),
inbox(2, "[email protected]"),
])
.expect("owned addresses remain after normalize");
let mut attendees = vec![
attendee("[email protected]", true),
attendee("[email protected]", false),
attendee("[email protected]", true),
];
actor.mark_attendees(&mut attendees, Uuid::from_u128(1));
assert!(
!attendees[0].is_self,
"another owned inbox is not this copy's"
);
assert!(attendees[1].is_self);
assert!(!attendees[2].is_self);
}
#[test]
fn a_copy_of_an_inbox_the_actor_does_not_own_marks_nobody() {
let actor = ActorInboxes::from_owned(vec![inbox(1, "[email protected]")])
.expect("owned addresses remain after normalize");
let mut attendees = vec![attendee("[email protected]", true)];
actor.mark_attendees(&mut attendees, Uuid::from_u128(9));
assert!(!attendees[0].is_self);
}