test: update GetAllFindings test to match filtering behavior

GetAllFindings now filters out info/watch severity findings,
only returning critical and warning. Update test expectation
from 3 findings to 2.
This commit is contained in:
rcourtman 2025-12-21 19:20:27 +00:00
parent 547fb65e39
commit 0ed453c1aa

View file

@ -863,6 +863,7 @@ func TestPatrolService_GetAllFindings(t *testing.T) {
ps := NewPatrolService(nil, nil)
// Add findings with different severities
// Note: GetAllFindings now filters out info/watch findings (only returns warning+)
ps.findings.Add(&Finding{
ID: "f1",
Severity: FindingSeverityInfo,
@ -884,8 +885,9 @@ func TestPatrolService_GetAllFindings(t *testing.T) {
findings := ps.GetAllFindings()
if len(findings) != 3 {
t.Fatalf("Expected 3 findings, got %d", len(findings))
// GetAllFindings filters out info/watch - only returns critical and warning
if len(findings) != 2 {
t.Fatalf("Expected 2 findings (critical+warning only), got %d", len(findings))
}
// Should be sorted by severity (critical first)
@ -895,9 +897,6 @@ func TestPatrolService_GetAllFindings(t *testing.T) {
if findings[1].Severity != FindingSeverityWarning {
t.Errorf("Expected second finding to be warning, got %s", findings[1].Severity)
}
if findings[2].Severity != FindingSeverityInfo {
t.Errorf("Expected third finding to be info, got %s", findings[2].Severity)
}
}
func TestPatrolService_GetFindingsHistory(t *testing.T) {