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::{FailJobCommand, FailJobHandler};
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;
fn make_handler(
job_repo: Arc<InMemoryJobRepository>,
@@ -26,10 +26,13 @@ async fn retries_on_failure() {
job_repo.save(&job).await.unwrap();
let handler = make_handler(job_repo.clone(), batch_repo.clone(), event_pub.clone());
let result = handler.execute(FailJobCommand {
job_id,
error: "transient error".into(),
}).await.unwrap();
let result = handler
.execute(FailJobCommand {
job_id,
error: "transient error".into(),
})
.await
.unwrap();
assert_eq!(result.status, JobStatus::Queued);
assert_eq!(result.retry_count, 1);
@@ -54,10 +57,13 @@ async fn fails_permanently_after_max_retries() {
job_repo.save(&job).await.unwrap();
let handler = make_handler(job_repo.clone(), batch_repo.clone(), event_pub.clone());
let result = handler.execute(FailJobCommand {
job_id,
error: "fatal".into(),
}).await.unwrap();
let result = handler
.execute(FailJobCommand {
job_id,
error: "fatal".into(),
})
.await
.unwrap();
assert_eq!(result.status, JobStatus::Failed);
assert_eq!(result.retry_count, 3);
@@ -76,8 +82,7 @@ async fn updates_batch_on_permanent_failure() {
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);
// Exhaust retries
job.fail("err1");
job.fail("err2");
@@ -85,10 +90,13 @@ async fn updates_batch_on_permanent_failure() {
job_repo.save(&job).await.unwrap();
let handler = make_handler(job_repo.clone(), batch_repo.clone(), event_pub.clone());
handler.execute(FailJobCommand {
job_id,
error: "permanent failure".into(),
}).await.unwrap();
handler
.execute(FailJobCommand {
job_id,
error: "permanent failure".into(),
})
.await
.unwrap();
let updated_batch = batch_repo.find_by_id(&batch_id).await.unwrap().unwrap();
assert_eq!(updated_batch.failed_count, 1);