@@ -106,7 +106,7 @@ test('it supports multiple dependencies within a single fragment', async () => {
106106 return Promise . resolve ( 0 )
107107 }
108108
109- const updatedDependencies = await updateMetadata . parse ( commitMessage , body , 'dependabot/nuget/api/main/coffee-rails' , 'main' , getAlert , getScore )
109+ const updatedDependencies = await updateMetadata . parse ( commitMessage , body , 'dependabot/nuget/api/main/coffee-rails/and/coffeescript ' , 'main' , getAlert , getScore )
110110
111111 expect ( updatedDependencies ) . toHaveLength ( 2 )
112112
@@ -299,6 +299,105 @@ test('it properly handles dependencies which contain slashes', async () => {
299299 expect ( updatedDependencies [ 0 ] . dependencyGroup ) . toEqual ( '' )
300300} )
301301
302+ test ( 'it handles branch names with hyphen separator' , async ( ) => {
303+ const commitMessage =
304+ '- [Release notes](https://github.com/fsevents/fsevents/releases)\n' +
305+ '- [Commits](fsevents/[email protected] )\n' + 306+ '\n' +
307+ '---\n' +
308+ 'updated-dependencies:\n' +
309+ '- dependency-name: fsevents\n' +
310+ ' dependency-type: indirect\n' +
311+ '...\n' +
312+ '\n' +
313+ 'Signed-off-by: dependabot[bot] <[email protected] >' 314+
315+ const getAlert = async ( ) => Promise . resolve ( { alertState : '' , ghsaId : '' , cvss : 0 } )
316+ const getScore = async ( ) => Promise . resolve ( 0 )
317+ const updatedDependencies = await updateMetadata . parse ( commitMessage , '' , 'dependabot-npm_and_yarn-fsevents-1.2.13' , 'master' , getAlert , getScore )
318+
319+ expect ( updatedDependencies [ 0 ] . directory ) . toEqual ( '/' )
320+ } )
321+
322+ test ( 'it handles branch names with hyphen separator and manifest files in nested directories' , async ( ) => {
323+ const commitMessage =
324+ '- [Release notes](https://github.com/fsevents/fsevents/releases)\n' +
325+ '- [Commits](fsevents/[email protected] )\n' + 326+ '\n' +
327+ '---\n' +
328+ 'updated-dependencies:\n' +
329+ '- dependency-name: fsevents\n' +
330+ ' dependency-type: indirect\n' +
331+ '...\n' +
332+ '\n' +
333+ 'Signed-off-by: dependabot[bot] <[email protected] >' 334+
335+ const getAlert = async ( ) => Promise . resolve ( { alertState : '' , ghsaId : '' , cvss : 0 } )
336+ const getScore = async ( ) => Promise . resolve ( 0 )
337+ const updatedDependencies = await updateMetadata . parse ( commitMessage , '' , 'dependabot-npm_and_yarn-nested-nested-fsevents-1.2.13' , 'master' , getAlert , getScore )
338+
339+ expect ( updatedDependencies [ 0 ] . directory ) . toEqual ( '/nested/nested' )
340+ } )
341+
342+ test ( 'it handles branch names with hyphen separator and dependency names with forward slashes' , async ( ) => {
343+ const commitMessage =
344+ '- [Release notes](https://github.com/composer/composer/releases)\n' +
345+ '- [Changelog](https://github.com/composer/composer/blob/main/CHANGELOG.md)\n' +
346+ '- [Commits](composer/[email protected] )\n' + 347+ '\n' +
348+ '---\n' +
349+ 'updated-dependencies:\n' +
350+ '- dependency-name: composer/composer\n' +
351+ ' dependency-type: indirect\n' +
352+ '...\n' +
353+ '\n' +
354+ 'Signed-off-by: dependabot[bot] <[email protected] >' 355+
356+ const getAlert = async ( ) => Promise . resolve ( { alertState : '' , ghsaId : '' , cvss : 0 } )
357+ const getScore = async ( ) => Promise . resolve ( 0 )
358+ const updatedDependencies = await updateMetadata . parse ( commitMessage , '' , 'dependabot-composer-composer-composer-2.6.5' , 'master' , getAlert , getScore )
359+
360+ expect ( updatedDependencies [ 0 ] . directory ) . toEqual ( '/' )
361+ } )
362+
363+ test ( 'it handles branch names with hyphen separator and multiple dependencies' , async ( ) => {
364+ const commitMessage =
365+ 'Updates `twilio-video` from 2.7.0 to 2.28.1\n' +
366+ '- [Release notes](https://github.com/twilio/twilio-video.js/releases)\n' +
367+ '- [Changelog](https://github.com/twilio/twilio-video.js/blob/master/CHANGELOG.md)\n' +
368+ '- [Commits](twilio/[email protected] )\n' + 369+ '\n' +
370+ 'Updates `@types/twilio-video` from 2.7.0 to 2.11.0\n' +
371+ '- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)\n' +
372+ '- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/twilio-video)\n' +
373+ '\n' +
374+ '---\n' +
375+ 'updated-dependencies:\n' +
376+ '- dependency-name: twilio-video\n' +
377+ ' dependency-type: direct:production\n' +
378+ ' update-type: version-update:semver-minor\n' +
379+ '- dependency-name: "@types/twilio-video"\n' +
380+ ' dependency-type: direct:development\n' +
381+ ' update-type: version-update:semver-minor\n' +
382+ '...\n' +
383+ '\n' +
384+ 'Signed-off-by: dependabot[bot] <[email protected] >' 385+
386+ const getAlert = async ( ) => Promise . resolve ( { alertState : '' , ghsaId : '' , cvss : 0 } )
387+ const getScore = async ( ) => Promise . resolve ( 0 )
388+
389+ const updatedDependencies = await updateMetadata . parse (
390+ commitMessage ,
391+ '' ,
392+ 'dependabot-npm_and_yarn-twilio-video-and-types-twilio-video-2.28.1' ,
393+ 'master' ,
394+ getAlert ,
395+ getScore
396+ )
397+
398+ expect ( updatedDependencies [ 0 ] . directory ) . toEqual ( '/' )
399+ } )
400+
302401test ( 'calculateUpdateType should handle all paths' , ( ) => {
303402 expect ( updateMetadata . calculateUpdateType ( '' , '' ) ) . toEqual ( '' )
304403 expect ( updateMetadata . calculateUpdateType ( '' , '1' ) ) . toEqual ( '' )
0 commit comments