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.6 KB
Raw Blame
//! Confirming which of several inboxes' copies a caller changes.
use super::*;
use crate::domain::copies::CopyChange;
use crate::domain::models::MeetingCopy;
use crate::domain::ports::CalendarCopyConfirmation;

const ORGANIZED: Uuid = Uuid::from_u128(7);
const INVITED: Uuid = Uuid::from_u128(8);

fn copies() -> Vec<MeetingCopy> {
    vec![
        MeetingCopy {
            event_id: INVITED,
            inbox: "[email protected]".to_string(),
            organizes: false,
            attends: true,
        },
        MeetingCopy {
            event_id: ORGANIZED,
            inbox: "[email protected]".to_string(),
            organizes: true,
            attends: false,
        },
    ]
}

#[tokio::test]
async fn confirming_a_copy_checks_the_requesters_copies_of_the_meeting() {
    let repo = FakeRepo {
        meeting_copies: copies(),
        ..Default::default()
    };
    let service = service(
        repo,
        FakeProvider::new(FakeProviderBehavior::Echo),
        FakeTokens::ok(),
    );

    let refusal = service
        .confirm_copy(
            "macro|[email protected]",
            ORGANIZED,
            None,
            CopyChange::Delete,
        )
        .await
        .unwrap()
        .expect("two inboxes hold the meeting");
    assert!(
        refusal.message().contains("[email protected] organizes it"),
        "{}",
        refusal.message()
    );
    assert_eq!(
        service
            .confirm_copy(
                "macro|[email protected]",
                ORGANIZED,
                Some("[email protected]"),
                CopyChange::Delete,
            )
            .await
            .unwrap(),
        None
    );
}