init
Some checks failed
CI / ci (push) Failing after 1m48s

This commit is contained in:
2026-08-25 23:24:36 +02:00
commit 95739892de
466 changed files with 33918 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
use std::sync::Arc;
use domain::ports::UserCommandPort;
use domain::testing::{InMemoryStore, test_user};
use domain::user::{DisplayName, Timezone};
use application::user::commands::UpdateProfileCommand;
use application::user::use_cases::{get_profile, update_profile};
#[tokio::test]
async fn get_profile_returns_user() {
let store = Arc::new(InMemoryStore::new());
let user = test_user("alice");
store.save(&user).await.unwrap();
let deps = get_profile::Deps {
user_query: store.clone(),
};
let result = get_profile::execute(user.id().clone(), &deps)
.await
.unwrap();
assert_eq!(result.username().value(), "alice");
}
#[tokio::test]
async fn updates_display_name_and_timezone() {
let store = Arc::new(InMemoryStore::new());
let user = test_user("alice");
store.save(&user).await.unwrap();
let deps = update_profile::Deps {
user_command: store.clone(),
user_query: store.clone(),
};
let cmd = UpdateProfileCommand {
user_id: user.id().clone(),
display_name: Some(DisplayName::new("Alice K").unwrap()),
timezone: Some(Timezone::new("Europe/Warsaw").unwrap()),
};
let updated = update_profile::execute(cmd, &deps).await.unwrap();
assert_eq!(updated.display_name().map(|d| d.value()), Some("Alice K"));
assert_eq!(updated.timezone().map(|t| t.value()), Some("Europe/Warsaw"));
}