use ironflow_store::models::RunStatus;
pub fn is_run_replayable(status: RunStatus) -> bool {
status.is_terminal()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn completed_run_is_replayable() {
assert!(is_run_replayable(RunStatus::Completed));
}
#[test]
fn failed_run_is_replayable() {
assert!(is_run_replayable(RunStatus::Failed));
}
#[test]
fn warning_run_is_replayable() {
assert!(is_run_replayable(RunStatus::Warning));
}
#[test]
fn cancelled_run_is_replayable() {
assert!(is_run_replayable(RunStatus::Cancelled));
}
#[test]
fn pending_run_is_not_replayable() {
assert!(!is_run_replayable(RunStatus::Pending));
}
#[test]
fn running_run_is_not_replayable() {
assert!(!is_run_replayable(RunStatus::Running));
}
#[test]
fn retrying_run_is_not_replayable() {
assert!(!is_run_replayable(RunStatus::Retrying));
}
#[test]
fn awaiting_approval_run_is_not_replayable() {
assert!(!is_run_replayable(RunStatus::AwaitingApproval));
}
#[test]
fn sleeping_run_is_not_replayable() {
assert!(!is_run_replayable(RunStatus::Sleeping));
}
}