diff --git a/crates/domain/src/events.rs b/crates/domain/src/events.rs index 48e4440..8250efa 100644 --- a/crates/domain/src/events.rs +++ b/crates/domain/src/events.rs @@ -56,6 +56,11 @@ pub enum DomainEvent { user_id: UserId, movie_id: MovieId, }, + FollowAccepted { + local_user_id: UserId, + remote_actor_url: String, + outbox_url: String, + }, } #[async_trait] @@ -82,3 +87,23 @@ impl EventEnvelope { self.ack.nack().await } } + +#[cfg(test)] +mod tests { + use super::*; + use crate::value_objects::UserId; + + #[test] + fn follow_accepted_matches() { + let uid = UserId::from_uuid(uuid::Uuid::new_v4()); + let event = DomainEvent::FollowAccepted { + local_user_id: uid.clone(), + remote_actor_url: "https://remote.example/users/alice".to_string(), + outbox_url: "https://remote.example/users/alice/outbox".to_string(), + }; + let DomainEvent::FollowAccepted { outbox_url, .. } = event else { + panic!("wrong variant"); + }; + assert_eq!(outbox_url, "https://remote.example/users/alice/outbox"); + } +}