test: shared factories and command builders

This commit is contained in:
2026-10-25 22:08:17 +01:00
parent 2ac1d4e0cf
commit 51d92e08a7
58 changed files with 784 additions and 1344 deletions

View File

@@ -1,6 +1,6 @@
use crate::test_support::register_command;
use std::sync::Arc;
use domain::models::UserRole;
use domain::ports::UserRepository;
use domain::testing::InMemoryUserRepository;
use domain::value_objects::Email;
@@ -11,12 +11,7 @@ use crate::{
};
fn cmd(email: &str) -> RegisterCommand {
RegisterCommand {
email: email.to_string(),
username: "alice".to_string(),
password: "password123".to_string(),
role: UserRole::Standard,
}
register_command(email, "alice")
}
#[tokio::test]
@@ -67,10 +62,8 @@ async fn test_register_short_password_fails() {
let result = register::execute(
&deps,
RegisterCommand {
email: "x@y.com".to_string(),
username: "testuser".to_string(),
password: "short".to_string(),
role: UserRole::Standard,
..register_command("x@y.com", "testuser")
},
)
.await;