MCPcopy Create free account
hub / github.com/conventionalcommit/commitlint / TestJSONFormatter_InputField

Function TestJSONFormatter_InputField

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

Source from the content-addressed store, hash-verified

118}
119
120func TestJSONFormatter_InputField(t *testing.T) {
121 linter := newDefaultLinter(t)
122 msg := "feat: check input field"
123 result, err := linter.ParseAndLint(msg)
124 if err != nil {
125 t.Fatal(err)
126 }
127 f := &formatter.JSONFormatter{}
128 out, fErr := f.Format(result)
129 if fErr != nil {
130 t.Fatal(fErr)
131 }
132 var parsed map[string]interface{}
133 if jErr := json.Unmarshal([]byte(out), &parsed); jErr != nil {
134 t.Fatal(jErr)
135 }
136 if parsed["input"] != msg {
137 t.Errorf("expected input %q, got %q", msg, parsed["input"])
138 }
139}
140
141func TestDefaultFormatter_TruncatesLongInput(t *testing.T) {
142 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