changes
All checks were successful
CI / ci (push) Successful in 19m38s

This commit is contained in:
2026-08-26 20:55:30 +02:00
parent a557c183e9
commit 23d052278a
523 changed files with 24448 additions and 2005 deletions

View File

@@ -1,9 +1,9 @@
use std::sync::Arc;
use domain::activity::ActivityId;
use domain::ports::ActivityCommandPort;
use domain::testing::{InMemoryStore, test_activity, test_user};
use domain::user::UserId;
use domain::entry::Mood;
use domain::ports::{ActivityCommandPort, MoodEntryCommandPort, MoodEntryQueryPort};
use domain::testing::{InMemoryStore, test_activity, test_entry, test_user};
use application::entry::use_cases::replace_activity;
@@ -13,18 +13,27 @@ async fn replaces_activity_on_entries() {
let user = test_user("alice");
let old = test_activity(user.id().clone(), "gaming");
let new = test_activity(user.id().clone(), "video games");
store.save(&old).await.unwrap();
store.save(&new).await.unwrap();
ActivityCommandPort::save(&*store, &old).await.unwrap();
ActivityCommandPort::save(&*store, &new).await.unwrap();
let entry = test_entry(user.id().clone(), Mood::Good);
MoodEntryCommandPort::save(&*store, &entry).await.unwrap();
store.assign_activities(entry.id(), vec![old.id().clone()]);
let deps = replace_activity::Deps {
entry_command: store.clone(),
activity_query: store.clone(),
};
let result =
replace_activity::execute(user.id().clone(), old.id().clone(), new.id().clone(), &deps)
.await;
assert!(result.is_ok());
replace_activity::execute(user.id().clone(), old.id().clone(), new.id().clone(), &deps)
.await
.unwrap();
let now_tagged_new = store.find_by_activity(user.id(), new.id()).await.unwrap();
let still_tagged_old = store.find_by_activity(user.id(), old.id()).await.unwrap();
assert_eq!(now_tagged_new.len(), 1);
assert!(still_tagged_old.is_empty());
}
#[tokio::test]
@@ -53,7 +62,9 @@ async fn rejects_target_owned_by_different_user() {
let alice = test_user("alice");
let bob = test_user("bob");
let bobs_activity = test_activity(bob.id().clone(), "gaming");
store.save(&bobs_activity).await.unwrap();
ActivityCommandPort::save(&*store, &bobs_activity)
.await
.unwrap();
let deps = replace_activity::Deps {
entry_command: store.clone(),