MCPcopy Create free account
hub / github.com/conforma/cli / Test_ReportText_ShowSuccesses

Function Test_ReportText_ShowSuccesses

internal/input/report_test.go:342–372  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

340}
341
342func 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
374func Test_ReportText_NoResultsSection(t *testing.T) {
375 // When there are only successes and showSuccesses=false, Results section should not appear

Callers

nothing calls this directly

Calls 3

toFormatMethod · 0.95
createTestPolicyFunction · 0.70
NewReportFunction · 0.70

Tested by

no test coverage detected