@@ -332,3 +332,78 @@ func TestUnifiedFindingPresenter_CliOutput(t *testing.T) {
332
332
assert .NotContains (t , out , "Total security issues" )
333
333
})
334
334
}
335
+
336
+ // TestUnifiedFindingPresenter_PendingIgnore_ShownAsOpenWithLabelAndBang verifies that pending ignores are shown as open with a label and ! marker.
337
+ func TestUnifiedFindingPresenter_PendingIgnore_ShownAsOpenWithLabelAndBang (t * testing.T ) {
338
+ config := configuration .New ()
339
+ buffer := & bytes.Buffer {}
340
+ // Use ASCII to avoid color codes in assertions
341
+ lipgloss .SetColorProfile (termenv .Ascii )
342
+
343
+ pendingFinding := testapi.FindingData {
344
+ Id : util .Ptr (uuid .New ()),
345
+ Type : util .Ptr (testapi .Findings ),
346
+ Attributes : & testapi.FindingAttributes {
347
+ Title : "Pending Suppression Finding" ,
348
+ Rating : testapi.Rating {Severity : testapi .Severity ("low" )},
349
+ Suppression : & testapi.Suppression {Status : testapi .SuppressionStatusPendingIgnoreApproval },
350
+ },
351
+ }
352
+
353
+ projectResult := & presenters.UnifiedProjectResult {
354
+ Findings : []testapi.FindingData {pendingFinding },
355
+ Summary : & json_schemas.TestSummary {
356
+ Type : "open-source" ,
357
+ Path : "test/path" ,
358
+ SeverityOrderAsc : []string {"low" , "medium" , "high" , "critical" },
359
+ Results : []json_schemas.TestSummaryResult {{Severity : "low" , Open : 1 , Total : 1 }},
360
+ },
361
+ }
362
+
363
+ presenter := presenters .NewUnifiedFindingsRenderer ([]* presenters.UnifiedProjectResult {projectResult }, config , buffer )
364
+ err := presenter .RenderTemplate (presenters .DefaultTemplateFiles , presenters .DefaultMimeType )
365
+ assert .NoError (t , err )
366
+
367
+ out := buffer .String ()
368
+ // Label should be inline on the issue line (after the title) with a preceding space
369
+ assert .Contains (t , out , " ! [LOW] Pending Suppression Finding [ PENDING IGNORE... ]" )
370
+ }
371
+
372
+ // TestUnifiedFindingPresenter_Ignored_ShownInIgnoredSectionWithBang verifies that ignored findings are shown in the ignored section with a ! marker.
373
+ func TestUnifiedFindingPresenter_Ignored_ShownInIgnoredSectionWithBang (t * testing.T ) {
374
+ config := configuration .New ()
375
+ buffer := & bytes.Buffer {}
376
+ // Ensure ignored section is rendered
377
+ config .Set ("include-ignores" , true )
378
+ // Use ASCII to avoid color codes in assertions
379
+ lipgloss .SetColorProfile (termenv .Ascii )
380
+
381
+ ignoredFinding := testapi.FindingData {
382
+ Id : util .Ptr (uuid .New ()),
383
+ Type : util .Ptr (testapi .Findings ),
384
+ Attributes : & testapi.FindingAttributes {
385
+ Title : "Ignored Suppression Finding" ,
386
+ Rating : testapi.Rating {Severity : testapi .Severity ("medium" )},
387
+ Suppression : & testapi.Suppression {Status : testapi .SuppressionStatusIgnored },
388
+ },
389
+ }
390
+
391
+ projectResult := & presenters.UnifiedProjectResult {
392
+ Findings : []testapi.FindingData {ignoredFinding },
393
+ Summary : & json_schemas.TestSummary {
394
+ Type : "open-source" ,
395
+ Path : "test/path" ,
396
+ SeverityOrderAsc : []string {"low" , "medium" , "high" , "critical" },
397
+ Results : []json_schemas.TestSummaryResult {{Severity : "medium" , Ignored : 1 , Total : 1 }},
398
+ },
399
+ }
400
+
401
+ presenter := presenters .NewUnifiedFindingsRenderer ([]* presenters.UnifiedProjectResult {projectResult }, config , buffer )
402
+ err := presenter .RenderTemplate (presenters .DefaultTemplateFiles , presenters .DefaultMimeType )
403
+ assert .NoError (t , err )
404
+
405
+ out := buffer .String ()
406
+ assert .Contains (t , out , "Ignored Issues" )
407
+ // Ignored entries appear with ! and IGNORED label
408
+ assert .Contains (t , out , " ! [IGNORED] [MEDIUM] Ignored Suppression Finding" )
409
+ }
0 commit comments