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

Function TestConfig_WriteCompactTo

test/config_test.go:164–187  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

162}
163
164func TestConfig_WriteCompactTo(t *testing.T) {
165 conf := config.NewDefault()
166 var buf bytes.Buffer
167 err := config.WriteCompactTo(&buf, conf)
168 if err != nil {
169 t.Fatalf("unexpected error: %v", err)
170 }
171 output := buf.String()
172 if output == "" {
173 t.Error("expected non-empty output from WriteCompactTo")
174 }
175
176 // Should only contain settings for the 5 enabled rules, not all 20
177 for _, disabled := range []string{"body-min-length", "body-max-length", "type-min-length", "scope-charset"} {
178 if bytes.Contains(buf.Bytes(), []byte(disabled+":")) {
179 t.Errorf("should not contain disabled rule setting %q", disabled)
180 }
181 }
182 for _, enabled := range []string{"header-min-length", "header-max-length", "type-enum"} {
183 if !bytes.Contains(buf.Bytes(), []byte(enabled+":")) {
184 t.Errorf("should contain enabled rule setting %q", enabled)
185 }
186 }
187}
188
189func TestConfig_WriteCompactTo_WithUserIgnores(t *testing.T) {
190 conf := config.NewDefault()

Callers

nothing calls this directly

Calls 4

NewDefaultFunction · 0.92
WriteCompactToFunction · 0.92
ErrorMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected