@@ -129,3 +129,29 @@ func TestBuildAssessReport_Summary(t *testing.T) {
129129 t .Error ("expected at least 1 keep recommendation" )
130130 }
131131}
132+
133+ func TestBuildAssessReport_ReviewCountSeparateFromKeep (t * testing.T ) {
134+ // Alert 1 is open with an overlap to a dismissed alert -> "review"
135+ // Alert 2 is dismissed -> "keep-dismissed"
136+ // Alert 3 is open, no overlaps -> "keep"
137+ alerts := []alertEntry {
138+ {Number : 1 , State : "open" , Rule : ruleEntry {ID : "js/sql-injection-v2" }, Location : locationEntry {Path : "src/db.js" , StartLine : 42 }},
139+ {Number : 2 , State : "dismissed" , Rule : ruleEntry {ID : "js/sql-injection" }, Location : locationEntry {Path : "src/db.js" , StartLine : 42 },
140+ DismissedReason : strPtr ("false positive" )},
141+ {Number : 3 , State : "open" , Rule : ruleEntry {ID : "js/xss" }, Location : locationEntry {Path : "src/views.js" , StartLine : 30 }},
142+ }
143+
144+ report := buildReport ("test/repo" , nil , alerts )
145+ assessed := assessAlerts (alerts )
146+ assessReport := buildAssessReport (report , assessed )
147+
148+ if assessReport .Summary .ReviewCount != 1 {
149+ t .Errorf ("reviewCount = %d, want 1" , assessReport .Summary .ReviewCount )
150+ }
151+ if assessReport .Summary .KeepCount != 1 {
152+ t .Errorf ("keepCount = %d, want 1 (only pure keep, not review)" , assessReport .Summary .KeepCount )
153+ }
154+ if assessReport .Summary .KeepDismissed != 1 {
155+ t .Errorf ("keepDismissedCount = %d, want 1" , assessReport .Summary .KeepDismissed )
156+ }
157+ }
0 commit comments