feat: atomic goal, watchlist, profile writes
This commit is contained in:
@@ -122,7 +122,7 @@ async fn deleting_a_review_removes_it_and_records_its_event_together() {
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn a_refused_delete_records_neither_the_removal_nor_its_event() {
|
||||
async fn a_refused_delete_propagates_and_records_nothing() {
|
||||
let movies = InMemoryStore::new();
|
||||
let diary = FakeDiaryQuery::new();
|
||||
let events = NoopEventPublisher::new();
|
||||
|
||||
@@ -151,7 +151,7 @@ async fn editing_a_review_saves_the_change_and_its_event_together() {
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn a_refused_edit_records_neither_the_change_nor_its_event() {
|
||||
async fn a_refused_edit_propagates_and_records_nothing() {
|
||||
let (reviews, review_id, user_id) = setup().await;
|
||||
let deps = EditReviewDeps {
|
||||
review: Arc::new(WriteRefusingReviews(Arc::clone(&reviews))),
|
||||
|
||||
@@ -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 _,
|
||||
|
||||
Reference in New Issue
Block a user