feat: atomic goal, watchlist, profile writes

This commit is contained in:
2026-10-26 00:49:28 +01:00
parent c8a1e8bfe4
commit 62ad9f4017
48 changed files with 1296 additions and 264 deletions

View File

@@ -68,7 +68,7 @@ async fn removes_from_watchlist_on_review() {
// Add to watchlist
let entry = WatchlistEntry::new(user_id.clone(), MovieId::from_uuid(movie_id));
watchlist.add(&entry).await.unwrap();
watchlist.add(&entry, &[]).await.unwrap();
assert_eq!(watchlist.watchlist_count(), 1);
// Log review for same movie
@@ -80,6 +80,20 @@ async fn removes_from_watchlist_on_review() {
logger.log_review(cmd).await.unwrap();
assert_eq!(watchlist.watchlist_count(), 0);
assert!(
movies
.recorded_events()
.iter()
.any(|e| matches!(e, domain::events::DomainEvent::WatchlistEntryRemoved { .. })),
"the removal event rides the watchlist write"
);
assert!(
!events
.published()
.iter()
.any(|e| matches!(e, domain::events::DomainEvent::WatchlistEntryRemoved { .. })),
"no longer published out of band"
);
}
#[tokio::test]
@@ -150,7 +164,7 @@ async fn watchlist_not_present_does_not_publish_removed() {
logger.log_review(cmd).await.unwrap();
let published = events.published();
let published = movies.recorded_events();
assert!(
!published
.iter()
@@ -260,7 +274,7 @@ async fn logging_a_review_saves_the_review_and_its_event_together() {
}
#[tokio::test]
async fn a_refused_save_records_neither_the_review_nor_its_event() {
async fn a_refused_save_propagates_and_records_nothing() {
let movies = InMemoryStore::new();
let logger = DefaultReviewLogger::new(
Arc::clone(&movies) as _,