@@ -60,10 +60,10 @@ func TestCheckMessageScope(t *testing.T) {
60
60
expectedError : "" ,
61
61
},
62
62
{
63
- name : "Invalid Scope - Uppercase" ,
64
- scope : "User" ,
65
- expectedError : `invalid commit message scope casing, "User" should be "user"` , // Expected error message
66
- },
63
+ name : "Invalid Scope - Uppercase" ,
64
+ scope : "User" ,
65
+ expectedError : `invalid commit message scope casing, "User" ` +
66
+ `should be "user"` },
67
67
}
68
68
69
69
for _ , tc := range testCases {
@@ -95,9 +95,10 @@ func TestCheckMessageSubject(t *testing.T) {
95
95
expectedError : "" ,
96
96
},
97
97
{
98
- name : "Invalid Subject - Uppercase" ,
99
- subject : "Add a new feature" ,
100
- expectedError : "commit message subject should be lowercased & not end with a period(.)" ,
98
+ name : "Invalid Subject - Uppercase" ,
99
+ subject : "Add a new feature" ,
100
+ expectedError : "commit message subject should be lowercased & " +
101
+ "not end with a period(.)" ,
101
102
},
102
103
}
103
104
@@ -130,10 +131,14 @@ func TestCheckMessageLength(t *testing.T) {
130
131
expectedError : "" ,
131
132
},
132
133
{
133
- name : "Invalid Length" ,
134
- message : "Add a new feature that makes the application run faster and more efficiently" ,
135
- expectedError : fmt .Sprintf ("commit message exceeds 50 characters, current length: %d" ,
136
- len ("Add a new feature that makes the application run faster and more efficiently" )),
134
+ name : "Invalid Length" ,
135
+ message : "Add a new feature that makes the application run " +
136
+ "faster and more efficiently" ,
137
+ expectedError : fmt .Sprintf (
138
+ "commit message exceeds 50 characters, current length: %d" ,
139
+ len ("Add a new feature that makes the application run " +
140
+ "faster and more efficiently" ),
141
+ ),
137
142
},
138
143
}
139
144
@@ -188,7 +193,8 @@ func TestValidateMessage(t *testing.T) {
188
193
Scope : "User" ,
189
194
Description : "add a new feature" ,
190
195
},
191
- expectedError : `invalid commit message scope casing, "User" should be "user"` ,
196
+ expectedError : `invalid commit message scope casing, "User" ` +
197
+ `should be "user"` ,
192
198
expectedMessage : "" ,
193
199
},
194
200
{
@@ -198,18 +204,23 @@ func TestValidateMessage(t *testing.T) {
198
204
Scope : "user" ,
199
205
Description : "Add a new feature" ,
200
206
},
201
- expectedError : "commit message subject should be lowercased & not end with a period(.)" ,
207
+ expectedError : "commit message subject should be lowercased & " +
208
+ "not end with a period(.)" ,
202
209
expectedMessage : "" ,
203
210
},
204
211
{
205
212
name : "Invalid Message - Exceeds Length" ,
206
213
message : parser.Message {
207
- Type : "feat" ,
208
- Scope : "user" ,
209
- Description : "add a new feature that makes the application run faster and more efficiently" , // More than 50 chars
214
+ Type : "feat" ,
215
+ Scope : "user" ,
216
+ Description : "add a new feature that makes the application run " +
217
+ "faster and more efficiently" ,
210
218
},
211
- expectedError : fmt .Sprintf ("commit message exceeds 50 characters, current length: %d" ,
212
- len ("Add a new feature that makes the application run faster and more efficiently" )),
219
+ expectedError : fmt .Sprintf (
220
+ "commit message exceeds 50 characters, current length: %d" ,
221
+ len ("Add a new feature that makes the application run " +
222
+ "faster and more efficiently" ),
223
+ ),
213
224
expectedMessage : "" ,
214
225
},
215
226
{
@@ -231,11 +242,14 @@ func TestValidateMessage(t *testing.T) {
231
242
if tc .expectedError == "" && err != nil {
232
243
t .Errorf ("expected no error, got %v" , err )
233
244
} else if err != nil && err .Error () != tc .expectedError {
234
- t .Errorf ("expected error %q, got %q" , tc .expectedError , err .Error ())
245
+ t .Errorf ("expected error %q, got %q" ,
246
+ tc .expectedError , err .Error ())
235
247
}
236
248
237
249
if messageResult != tc .expectedMessage {
238
- t .Errorf ("expected message %q, got %q" , tc .expectedMessage , messageResult )
250
+ t .Errorf ("expected message %q, got %q" ,
251
+ tc .expectedMessage , messageResult ,
252
+ )
239
253
}
240
254
})
241
255
}
0 commit comments