@@ -295,5 +295,57 @@ describe('parse', () => {
295295 expect ( commit . hash ) . toBe ( '1234567' )
296296 expect ( commit . type ) . toBe ( 'feat' )
297297 } )
298+
299+ it ( 'should handle notes followed by other notes' , ( ) => {
300+ const commit = parse ( 'feat: subject\n\nBREAKING CHANGE: note 1\nBREAKING CHANGE: note 2' )
301+
302+ expect ( commit . notes ) . toHaveLength ( 2 )
303+ expect ( commit . notes [ 0 ] . text ) . toBe ( 'note 1' )
304+ expect ( commit . notes [ 1 ] . text ) . toBe ( 'note 2' )
305+ } )
306+
307+ it ( 'should handle notes followed by references' , ( ) => {
308+ const commit = parse ( 'feat: subject\n\nBREAKING CHANGE: note 1\nCloses #123' )
309+ expect ( commit . notes [ 0 ] . text ) . toBe ( 'note 1' )
310+ expect ( commit . references [ 0 ] . issue ) . toBe ( '123' )
311+ } )
312+
313+ it ( 'should handle merge commits with correspondence that are not manageable' , ( ) => {
314+ const parse = createParser ( {
315+ mergePattern : / ^ M e r g e b r a n c h ' ( [ \w - ] + ) ' / ,
316+ mergeCorrespondence : [ 'nonManageable' ] ,
317+ } )
318+
319+ const commit = parse ( 'Merge branch \'feature\'\nheader' )
320+
321+ expect ( commit . meta . nonManageable ) . toBe ( 'feature' )
322+ } )
323+
324+ it ( 'should handle parseReference returning null for malformed reference' , ( ) => {
325+ const parse = createParser ( {
326+ issuePrefixes : [ '#' ] ,
327+ } )
328+
329+ const commit = parse ( 'fix: something with # but no number #abc' )
330+
331+ expect ( commit . references ) . toEqual ( [ ] )
332+ } )
333+
334+ it ( 'should handle parseRevert with missing correspondence fields' , ( ) => {
335+ const parse = createParser ( {
336+ revertPattern : / ^ R e v e r t ( .* ) / ,
337+ revertCorrespondence : [ 'customField' ] ,
338+ } )
339+
340+ const commit = parse ( 'Revert some subject' )
341+
342+ expect ( commit . revert ?. customField ) . toBe ( 'some subject' )
343+ } )
344+
345+ it ( 'should handle trimLineBreaks for only line breaks' , ( ) => {
346+ const commit = parse ( '\n\n' )
347+
348+ expect ( commit . header ) . toBe ( null )
349+ } )
298350 } )
299351} )
0 commit comments