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,13 +1,11 @@
use crate::test_support::create_goal_command;
use std::sync::Arc;
use domain::testing::{FakeStatsRepository, InMemoryGoalRepository, NoopEventPublisher};
use uuid::Uuid;
use crate::goals::deps::GoalCommandDeps;
use crate::goals::{
commands::{CreateGoalCommand, DeleteGoalCommand},
create, delete,
};
use crate::goals::{commands::DeleteGoalCommand, create, delete};
use crate::test_helpers::TestContextBuilder;
#[tokio::test]
@@ -22,16 +20,9 @@ async fn deletes_existing_goal() {
event_publisher: Arc::clone(&events) as _,
};
create::execute(
&deps,
CreateGoalCommand {
user_id: Uuid::nil(),
year: 2025,
target_count: 10,
},
)
.await
.unwrap();
create::execute(&deps, create_goal_command(2025, 10))
.await
.unwrap();
assert_eq!(goals.count(), 1);
delete::execute(