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

Function TestBodyLeadingBlank_WithBlank_Pass

test/rule_test.go:1066–1080  ·  view source on GitHub ↗

============================================================ Leading-blank rules ============================================================

(t *testing.T)

Source from the content-addressed store, hash-verified

1064// ============================================================
1065
1066func TestBodyLeadingBlank_WithBlank_Pass(t *testing.T) {
1067 r := &rule.BodyLeadingBlankRule{}
1068 if err := r.Apply(lint.RuleSetting{}); err != nil {
1069 t.Fatal(err)
1070 }
1071 // message: header + blank line + body
1072 msg := &mockCommit{
1073 message: "feat: add feature\n\nThis is the body",
1074 body: "This is the body",
1075 }
1076 _, ok := r.Validate(msg)
1077 if !ok {
1078 t.Error("body with leading blank line should pass")
1079 }
1080}
1081
1082func TestBodyLeadingBlank_WithoutBlank_Fail(t *testing.T) {
1083 r := &rule.BodyLeadingBlankRule{}

Callers

nothing calls this directly

Calls 3

ApplyMethod · 0.95
ValidateMethod · 0.95
ErrorMethod · 0.80

Tested by

no test coverage detected