Skip to content

Commit 6e36a86

Browse files
test: strengthen weak assertions in safe_outputs analyzer tests (#891)
1 parent e3beb0f commit 6e36a86

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/audit/analyzers/safe_outputs.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,15 @@ mod tests {
777777
.await
778778
.expect("analyze gate-rejected safe outputs");
779779

780+
let summary = analysis.summary.expect("summary");
781+
assert_eq!(summary.proposed_count, 2);
782+
assert_eq!(
783+
summary.not_processed_count, 2,
784+
"all proposals must be counted as not_processed when the gate fires"
785+
);
786+
assert_eq!(summary.executed_count, 0);
787+
assert_eq!(summary.rejected_by_execution_count, 0);
788+
780789
let execution = analysis.execution.expect("execution");
781790
assert_eq!(execution.items.len(), 2);
782791
assert!(execution.items.iter().all(|item| {
@@ -791,6 +800,11 @@ mod tests {
791800

792801
assert_eq!(analysis.findings.len(), 1);
793802
assert_eq!(analysis.findings[0].severity, Severity::High);
803+
assert_eq!(analysis.findings[0].category, "safe_outputs");
804+
assert_eq!(
805+
analysis.findings[0].title,
806+
"Detection rejected 2 safe output(s)"
807+
);
794808
}
795809

796810
#[tokio::test]
@@ -849,6 +863,7 @@ mod tests {
849863
);
850864

851865
let rollup = analysis.rollup.expect("rollup");
866+
assert_eq!(rollup.total_rejected, 2);
852867
assert_eq!(rollup.by_reason.get("permission denied"), Some(&1));
853868
assert_eq!(rollup.by_reason.get("skipped"), Some(&1));
854869
}

0 commit comments

Comments
 (0)