32 lines
811 B
Rust
32 lines
811 B
Rust
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);
|
|
}
|