style: cargo fmt --all

This commit is contained in:
2026-05-31 05:31:42 +02:00
parent 4b31a0f74b
commit c2ebca0da0
138 changed files with 2422 additions and 1164 deletions

View File

@@ -1,21 +1,29 @@
use std::sync::Arc;
use application::identity::{
GetProfileHandler, GetProfileQuery, RegisterUserCommand, RegisterUserHandler,
};
use application::testing::{InMemoryUserRepository, StubPasswordHasher};
use application::identity::{RegisterUserCommand, RegisterUserHandler, GetProfileQuery, GetProfileHandler};
use domain::errors::DomainError;
use domain::value_objects::SystemId;
use std::sync::Arc;
#[tokio::test]
async fn returns_existing_user() {
let repo = Arc::new(InMemoryUserRepository::new());
let reg = RegisterUserHandler::new(repo.clone(), Arc::new(StubPasswordHasher));
let user = reg.execute(RegisterUserCommand {
username: "alice".into(),
email: "alice@example.com".into(),
password: "password123".into(),
}).await.unwrap();
let user = reg
.execute(RegisterUserCommand {
username: "alice".into(),
email: "alice@example.com".into(),
password: "password123".into(),
})
.await
.unwrap();
let handler = GetProfileHandler::new(repo);
let found = handler.execute(GetProfileQuery { user_id: user.id }).await.unwrap();
let found = handler
.execute(GetProfileQuery { user_id: user.id })
.await
.unwrap();
assert_eq!(found.username, "alice");
}
@@ -23,6 +31,10 @@ async fn returns_existing_user() {
async fn returns_not_found_for_missing_user() {
let repo = Arc::new(InMemoryUserRepository::new());
let handler = GetProfileHandler::new(repo);
let result = handler.execute(GetProfileQuery { user_id: SystemId::new() }).await;
let result = handler
.execute(GetProfileQuery {
user_id: SystemId::new(),
})
.await;
assert!(matches!(result, Err(DomainError::NotFound(_))));
}