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 macro_db_migrator::MACRO_DB_MIGRATIONS;
use macro_uuid::Uuid;
/// One stored bot with a profile; every other bot has none.
struct ProfiledBot;
impl BotNames for ProfiledBot {
async fn bot_names(&self, bot_ids: &[BotId]) -> Result<HashMap<BotId, String>> {
Ok(bot_ids
.iter()
.filter(|bot_id| **bot_id == BotId::new_from_uuid(Uuid::from_u128(1)))
.map(|bot_id| (*bot_id, "Release Bot".to_owned()))
.collect())
}
}
#[sqlx::test(
migrator = "MACRO_DB_MIGRATIONS",
fixtures(path = "fixtures", scripts("people"))
)]
async fn names_each_id_in_order(pool: PgPool) {
let directory = PgPeopleDirectory::new(pool, ProfiledBot);
let people = directory
.people(vec![
"macro|[email protected]".to_owned(),
"bot|00000000-0000-0000-0000-000000000001".to_owned(),
"macro|[email protected]".to_owned(),
"macro|[email protected]".to_owned(),
"bot|00000000-0000-0000-0000-000000000002".to_owned(),
"macro|[email protected]".to_owned(),
])
.await
.unwrap();
assert_eq!(
people,
[
ContextPerson {
id: "macro|[email protected]".to_owned(),
name: "Julia Rivera".to_owned(),
email: Some("[email protected]".to_owned()),
},
ContextPerson {
id: "bot|00000000-0000-0000-0000-000000000001".to_owned(),
name: "Release Bot".to_owned(),
email: None,
},
ContextPerson {
id: "macro|[email protected]".to_owned(),
name: "Teo".to_owned(),
email: Some("[email protected]".to_owned()),
},
ContextPerson {
id: "macro|[email protected]".to_owned(),
name: "[email protected]".to_owned(),
email: Some("[email protected]".to_owned()),
},
ContextPerson {
id: "bot|00000000-0000-0000-0000-000000000002".to_owned(),
name: "bot|00000000-0000-0000-0000-000000000002".to_owned(),
email: None,
},
ContextPerson {
id: "macro|[email protected]".to_owned(),
name: "Julia Rivera".to_owned(),
email: Some("[email protected]".to_owned()),
},
]
);
}