test: shared factories and command builders
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user