@@ -130,32 +130,57 @@ https://${'very-'.repeat(80)}-long-url.org/
130130 } )
131131
132132 t . test ( 'Co-author lines' , ( tt ) => {
133+ const sha = 'f1496de5a7d5474e39eafaafe6f79befe5883a5b'
134+ const author = {
135+ name : 'Jacob Smith' ,
136+ 137+ date : '2025-12-22T09:40:42Z'
138+ }
139+
133140 const v = new Validator ( )
134- const context = new Commit ( {
135- sha : 'f1496de5a7d5474e39eafaafe6f79befe5883a5b' ,
136- author : {
137- name : 'Jacob Smith' ,
138- 139- date : '2025-12-22T09:40:42Z'
140- } ,
141- message : `
142- fixup!: apply case-insensitive suggestion
143- Co-authored-by: Michaël Zasso <[email protected] > 144- `
141+ const overlongMessage = `fixup!: apply case-insensitive suggestion
142+ Co-authored-by: Michaël Zasso <[email protected] >` 143+ const bad = new Commit ( {
144+ sha,
145+ author,
146+ message : overlongMessage ,
145147 } , v )
146148
147- context . report = ( opts ) => {
149+ bad . report = ( opts ) => {
150+ tt . pass ( 'called report' )
151+ tt . equal ( opts . id , 'line-length' , 'id' )
152+ tt . equal ( opts . string , overlongMessage . split ( '\n' ) [ 1 ] , 'string' )
153+ tt . equal ( opts . level , 'fail' , 'level' )
154+ }
155+
156+ Rule . validate ( bad , {
157+ options : {
158+ length : 72
159+ }
160+ } )
161+
162+ const good = new Commit ( {
163+ sha,
164+ author,
165+ message : [
166+ 'fixup!: apply case-insensitive suggestion' ,
167+ 'Co-authored-by: Michaël Zasso <[email protected] >' 168+ ] . join ( '\n' )
169+ } , v )
170+
171+ good . report = ( opts ) => {
148172 tt . pass ( 'called report' )
149173 tt . equal ( opts . id , 'line-length' , 'id' )
150174 tt . equal ( opts . string , '' , 'string' )
151175 tt . equal ( opts . level , 'pass' , 'level' )
152176 }
153177
154- Rule . validate ( context , {
178+ Rule . validate ( good , {
155179 options : {
156180 length : 72
157181 }
158182 } )
183+
159184 tt . end ( )
160185 } )
161186
0 commit comments