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,10 +1,10 @@
use std::sync::Arc;
use application::testing::{InMemoryJobBatchRepository, InMemoryJobRepository, StubEventPublisher};
use application::processing::{CompleteJobCommand, CompleteJobHandler};
use application::testing::{InMemoryJobBatchRepository, InMemoryJobRepository, StubEventPublisher};
use domain::entities::{Job, JobBatch, JobStatus, JobType};
use domain::events::DomainEvent;
use domain::ports::{JobBatchRepository, JobRepository};
use domain::value_objects::StructuredData;
use std::sync::Arc;
#[tokio::test]
async fn completes_job() {
@@ -18,10 +18,13 @@ async fn completes_job() {
job_repo.save(&job).await.unwrap();
let handler = CompleteJobHandler::new(job_repo.clone(), batch_repo.clone(), event_pub.clone());
let result = handler.execute(CompleteJobCommand {
job_id,
result: StructuredData::new(),
}).await.unwrap();
let result = handler
.execute(CompleteJobCommand {
job_id,
result: StructuredData::new(),
})
.await
.unwrap();
assert_eq!(result.status, JobStatus::Completed);
assert!(result.result_data.is_some());
@@ -37,17 +40,19 @@ async fn completes_job_and_updates_batch() {
let batch_id = batch.batch_id;
batch_repo.save(&batch).await.unwrap();
let mut job = Job::new(JobType::ExtractMetadata, 5, StructuredData::new())
.with_batch(batch_id);
let mut job = Job::new(JobType::ExtractMetadata, 5, StructuredData::new()).with_batch(batch_id);
job.start().unwrap();
let job_id = job.job_id;
job_repo.save(&job).await.unwrap();
let handler = CompleteJobHandler::new(job_repo.clone(), batch_repo.clone(), event_pub.clone());
handler.execute(CompleteJobCommand {
job_id,
result: StructuredData::new(),
}).await.unwrap();
handler
.execute(CompleteJobCommand {
job_id,
result: StructuredData::new(),
})
.await
.unwrap();
let updated_batch = batch_repo.find_by_id(&batch_id).await.unwrap().unwrap();
assert_eq!(updated_batch.completed_count, 1);
@@ -65,10 +70,13 @@ async fn publishes_event() {
job_repo.save(&job).await.unwrap();
let handler = CompleteJobHandler::new(job_repo.clone(), batch_repo.clone(), event_pub.clone());
handler.execute(CompleteJobCommand {
job_id,
result: StructuredData::new(),
}).await.unwrap();
handler
.execute(CompleteJobCommand {
job_id,
result: StructuredData::new(),
})
.await
.unwrap();
let events = event_pub.published().await;
assert_eq!(events.len(), 1);