use ainl_contracts::ContextFreshness;
#[must_use]
pub fn should_emit_failure_suggestion(freshness_at_failure: Option<ContextFreshness>) -> bool {
!matches!(freshness_at_failure, Some(ContextFreshness::Stale))
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn stale_blocks_suggestion() {
assert!(!should_emit_failure_suggestion(Some(
ContextFreshness::Stale
)));
}
#[test]
fn fresh_or_unknown_allows() {
assert!(should_emit_failure_suggestion(Some(
ContextFreshness::Fresh
)));
assert!(should_emit_failure_suggestion(Some(
ContextFreshness::Unknown
)));
assert!(should_emit_failure_suggestion(None));
}
}