style: cargo fmt --all
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
use std::sync::Arc;
|
||||
use application::processing::{
|
||||
ConfigurePipelineCommand, ConfigurePipelineHandler, PipelineStepConfig,
|
||||
};
|
||||
use application::testing::{InMemoryPipelineRepository, InMemoryPluginRepository};
|
||||
use application::processing::{ConfigurePipelineCommand, ConfigurePipelineHandler, PipelineStepConfig};
|
||||
use domain::entities::{Plugin, PluginType};
|
||||
use domain::errors::DomainError;
|
||||
use domain::ports::PluginRepository;
|
||||
use domain::value_objects::{StructuredData, SystemId};
|
||||
use std::sync::Arc;
|
||||
|
||||
#[tokio::test]
|
||||
async fn creates_pipeline() {
|
||||
@@ -19,13 +21,22 @@ async fn creates_pipeline() {
|
||||
plugin_repo.save(&p2).await.unwrap();
|
||||
|
||||
let handler = ConfigurePipelineHandler::new(pipeline_repo.clone(), plugin_repo.clone());
|
||||
let pipeline = handler.execute(ConfigurePipelineCommand {
|
||||
trigger_event: "asset.ingested".into(),
|
||||
steps: vec![
|
||||
PipelineStepConfig { plugin_id: p1_id, config: StructuredData::new() },
|
||||
PipelineStepConfig { plugin_id: p2_id, config: StructuredData::new() },
|
||||
],
|
||||
}).await.unwrap();
|
||||
let pipeline = handler
|
||||
.execute(ConfigurePipelineCommand {
|
||||
trigger_event: "asset.ingested".into(),
|
||||
steps: vec![
|
||||
PipelineStepConfig {
|
||||
plugin_id: p1_id,
|
||||
config: StructuredData::new(),
|
||||
},
|
||||
PipelineStepConfig {
|
||||
plugin_id: p2_id,
|
||||
config: StructuredData::new(),
|
||||
},
|
||||
],
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(pipeline.trigger_event, "asset.ingested");
|
||||
assert_eq!(pipeline.steps.len(), 2);
|
||||
@@ -37,12 +48,15 @@ async fn rejects_nonexistent_plugin() {
|
||||
let plugin_repo = Arc::new(InMemoryPluginRepository::new());
|
||||
|
||||
let handler = ConfigurePipelineHandler::new(pipeline_repo.clone(), plugin_repo.clone());
|
||||
let result = handler.execute(ConfigurePipelineCommand {
|
||||
trigger_event: "asset.ingested".into(),
|
||||
steps: vec![
|
||||
PipelineStepConfig { plugin_id: SystemId::new(), config: StructuredData::new() },
|
||||
],
|
||||
}).await;
|
||||
let result = handler
|
||||
.execute(ConfigurePipelineCommand {
|
||||
trigger_event: "asset.ingested".into(),
|
||||
steps: vec![PipelineStepConfig {
|
||||
plugin_id: SystemId::new(),
|
||||
config: StructuredData::new(),
|
||||
}],
|
||||
})
|
||||
.await;
|
||||
|
||||
assert!(matches!(result, Err(DomainError::NotFound(_))));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user