(t *testing.T)
| 340 | } |
| 341 | |
| 342 | func Test_ReportText_ShowSuccesses(t *testing.T) { |
| 343 | inputs := []Input{ |
| 344 | { |
| 345 | FilePath: "/path/to/file1.yaml", |
| 346 | Successes: []evaluator.Result{ |
| 347 | { |
| 348 | Message: "success1", |
| 349 | Metadata: map[string]interface{}{ |
| 350 | "code": "test.success", |
| 351 | }, |
| 352 | }, |
| 353 | }, |
| 354 | SuccessCount: 1, |
| 355 | Success: true, |
| 356 | }, |
| 357 | } |
| 358 | ctx := context.Background() |
| 359 | testPolicy := createTestPolicy(t, ctx) |
| 360 | report, err := NewReport(inputs, testPolicy, nil, true, true, true) |
| 361 | assert.NoError(t, err) |
| 362 | |
| 363 | reportText, err := report.toFormat(Text) |
| 364 | assert.NoError(t, err) |
| 365 | textOutput := string(reportText) |
| 366 | |
| 367 | // Verify successes are shown when showSuccesses=true |
| 368 | assert.Contains(t, textOutput, "Success: true") |
| 369 | assert.Contains(t, textOutput, "Result: SUCCESS") |
| 370 | assert.Contains(t, textOutput, "Successes: 1") |
| 371 | assert.Contains(t, textOutput, "[Success] test.success") |
| 372 | } |
| 373 | |
| 374 | func Test_ReportText_NoResultsSection(t *testing.T) { |
| 375 | // When there are only successes and showSuccesses=false, Results section should not appear |
nothing calls this directly
no test coverage detected