refactor(goals): scoped Arc deps instead of AppContext
This commit is contained in:
@@ -13,13 +13,10 @@ use crate::test_helpers::TestContextBuilder;
|
||||
async fn deletes_existing_goal() {
|
||||
let goals = InMemoryGoalRepository::new();
|
||||
let events = NoopEventPublisher::new();
|
||||
let ctx = TestContextBuilder::new()
|
||||
.with_goal(Arc::clone(&goals) as _)
|
||||
.with_event_publisher(Arc::clone(&events) as _)
|
||||
.build();
|
||||
|
||||
create::execute(
|
||||
&ctx,
|
||||
Arc::clone(&goals) as _,
|
||||
Arc::clone(&events) as _,
|
||||
CreateGoalCommand {
|
||||
user_id: Uuid::nil(),
|
||||
year: 2025,
|
||||
@@ -31,7 +28,8 @@ async fn deletes_existing_goal() {
|
||||
assert_eq!(goals.count(), 1);
|
||||
|
||||
delete::execute(
|
||||
&ctx,
|
||||
Arc::clone(&goals) as _,
|
||||
Arc::clone(&events) as _,
|
||||
DeleteGoalCommand {
|
||||
user_id: Uuid::nil(),
|
||||
year: 2025,
|
||||
@@ -45,9 +43,10 @@ async fn deletes_existing_goal() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn fails_when_not_found() {
|
||||
let ctx = TestContextBuilder::new().build();
|
||||
let b = TestContextBuilder::new();
|
||||
let result = delete::execute(
|
||||
&ctx,
|
||||
b.goal_repo.clone(),
|
||||
b.event_publisher.clone(),
|
||||
DeleteGoalCommand {
|
||||
user_id: Uuid::nil(),
|
||||
year: 2025,
|
||||
|
||||
Reference in New Issue
Block a user