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

Function Test_ReportText_NoResultsSection

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

Source from the content-addressed store, hash-verified

372}
373
374func Test_ReportText_NoResultsSection(t *testing.T) {
375 // When there are only successes and showSuccesses=false, Results section should not appear
376 inputs := []Input{
377 {
378 FilePath: "/path/to/file1.yaml",
379 SuccessCount: 1,
380 Success: true,
381 },
382 }
383 ctx := context.Background()
384 testPolicy := createTestPolicy(t, ctx)
385 report, err := NewReport(inputs, testPolicy, nil, false, true, true)
386 assert.NoError(t, err)
387
388 reportText, err := report.toFormat(Text)
389 assert.NoError(t, err)
390 textOutput := string(reportText)
391
392 // Results section should not appear when there's nothing to show
393 assert.Contains(t, textOutput, "Success: true")
394 assert.Contains(t, textOutput, "Result: SUCCESS")
395 assert.NotContains(t, textOutput, "Results:")
396}
397
398func createTestPolicy(t *testing.T, ctx context.Context) policy.Policy {
399 utils.SetTestRekorPublicKey(t)

Callers

nothing calls this directly

Calls 3

toFormatMethod · 0.95
createTestPolicyFunction · 0.70
NewReportFunction · 0.70

Tested by

no test coverage detected