MCPcopy Index your code
hub / github.com/conventionalcommit/commitlint / TestJSONFormatter_NoIssues

Function TestJSONFormatter_NoIssues

test/formatter_test.go:60–82  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

58}
59
60func TestJSONFormatter_NoIssues(t *testing.T) {
61 linter := newDefaultLinter(t)
62 result, err := linter.ParseAndLint("feat: valid commit message")
63 if err != nil {
64 t.Fatal(err)
65 }
66 f := &formatter.JSONFormatter{}
67 out, fErr := f.Format(result)
68 if fErr != nil {
69 t.Fatal(fErr)
70 }
71 var parsed map[string]interface{}
72 if jErr := json.Unmarshal([]byte(out), &parsed); jErr != nil {
73 t.Fatalf("invalid JSON output: %v", jErr)
74 }
75 issues, ok := parsed["issues"].([]interface{})
76 if !ok {
77 t.Fatal("expected 'issues' array in JSON output")
78 }
79 if len(issues) != 0 {
80 t.Errorf("expected 0 issues, got %d", len(issues))
81 }
82}
83
84func TestJSONFormatter_WithIssues(t *testing.T) {
85 linter := newDefaultLinter(t)

Callers

nothing calls this directly

Calls 3

FormatMethod · 0.95
newDefaultLinterFunction · 0.85
ParseAndLintMethod · 0.80

Tested by

no test coverage detected