style: cargo fmt --all
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
use std::sync::Arc;
|
||||
use application::testing::{InMemoryJobRepository, StubEventPublisher};
|
||||
use application::processing::{EnqueueJobCommand, EnqueueJobHandler};
|
||||
use application::testing::{InMemoryJobRepository, StubEventPublisher};
|
||||
use domain::entities::{JobStatus, JobType};
|
||||
use domain::events::DomainEvent;
|
||||
use domain::value_objects::{StructuredData, SystemId};
|
||||
use std::sync::Arc;
|
||||
|
||||
#[tokio::test]
|
||||
async fn enqueues_job() {
|
||||
@@ -11,13 +11,16 @@ async fn enqueues_job() {
|
||||
let event_pub = Arc::new(StubEventPublisher::new());
|
||||
let handler = EnqueueJobHandler::new(job_repo.clone(), event_pub.clone());
|
||||
|
||||
let job = handler.execute(EnqueueJobCommand {
|
||||
job_type: JobType::ExtractMetadata,
|
||||
priority: 5,
|
||||
payload: StructuredData::new(),
|
||||
target_asset_id: None,
|
||||
batch_id: None,
|
||||
}).await.unwrap();
|
||||
let job = handler
|
||||
.execute(EnqueueJobCommand {
|
||||
job_type: JobType::ExtractMetadata,
|
||||
priority: 5,
|
||||
payload: StructuredData::new(),
|
||||
target_asset_id: None,
|
||||
batch_id: None,
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(job.status, JobStatus::Queued);
|
||||
assert_eq!(job.priority, 5);
|
||||
@@ -33,13 +36,16 @@ async fn enqueues_with_target_and_batch() {
|
||||
|
||||
let target = SystemId::new();
|
||||
let batch = SystemId::new();
|
||||
let job = handler.execute(EnqueueJobCommand {
|
||||
job_type: JobType::GenerateDerivative,
|
||||
priority: 10,
|
||||
payload: StructuredData::new(),
|
||||
target_asset_id: Some(target),
|
||||
batch_id: Some(batch),
|
||||
}).await.unwrap();
|
||||
let job = handler
|
||||
.execute(EnqueueJobCommand {
|
||||
job_type: JobType::GenerateDerivative,
|
||||
priority: 10,
|
||||
payload: StructuredData::new(),
|
||||
target_asset_id: Some(target),
|
||||
batch_id: Some(batch),
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(job.target_asset_id, Some(target));
|
||||
assert_eq!(job.batch_id, Some(batch));
|
||||
@@ -51,13 +57,16 @@ async fn publishes_event() {
|
||||
let event_pub = Arc::new(StubEventPublisher::new());
|
||||
let handler = EnqueueJobHandler::new(job_repo.clone(), event_pub.clone());
|
||||
|
||||
let job = handler.execute(EnqueueJobCommand {
|
||||
job_type: JobType::ScanDirectory,
|
||||
priority: 1,
|
||||
payload: StructuredData::new(),
|
||||
target_asset_id: None,
|
||||
batch_id: None,
|
||||
}).await.unwrap();
|
||||
let job = handler
|
||||
.execute(EnqueueJobCommand {
|
||||
job_type: JobType::ScanDirectory,
|
||||
priority: 1,
|
||||
payload: StructuredData::new(),
|
||||
target_asset_id: None,
|
||||
batch_id: None,
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let events = event_pub.published().await;
|
||||
assert_eq!(events.len(), 1);
|
||||
|
||||
Reference in New Issue
Block a user