domain: add Processing entities and ports (Job, JobBatch, Plugin, Pipeline)
This commit is contained in:
31
crates/domain/tests/entities/job_batch.rs
Normal file
31
crates/domain/tests/entities/job_batch.rs
Normal file
@@ -0,0 +1,31 @@
|
||||
use domain::entities::{BatchStatus, JobBatch};
|
||||
|
||||
#[test]
|
||||
fn completes_when_all_done() {
|
||||
let mut batch = JobBatch::new("scan", 3);
|
||||
batch.record_completion();
|
||||
batch.record_completion();
|
||||
batch.record_completion();
|
||||
assert_eq!(batch.status, BatchStatus::Completed);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn completes_with_errors() {
|
||||
let mut batch = JobBatch::new("scan", 3);
|
||||
batch.record_completion();
|
||||
batch.record_failure();
|
||||
batch.record_completion();
|
||||
assert_eq!(batch.status, BatchStatus::CompletedWithErrors);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn progress_tracking() {
|
||||
let mut batch = JobBatch::new("scan", 4);
|
||||
assert_eq!(batch.progress_percent(), 0.0);
|
||||
|
||||
batch.record_completion();
|
||||
assert_eq!(batch.progress_percent(), 25.0);
|
||||
|
||||
batch.record_completion();
|
||||
assert_eq!(batch.progress_percent(), 50.0);
|
||||
}
|
||||
Reference in New Issue
Block a user