-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle branch names containing hyphen separators
- Loading branch information
1 parent
363356d
commit cee26fc
Showing
2 changed files
with
67 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -299,6 +299,67 @@ test('it properly handles dependencies which contain slashes', async () => { | |
expect(updatedDependencies[0].dependencyGroup).toEqual('') | ||
}) | ||
|
||
test('it handles branch names with hyphen separator', async () => { | ||
const commitMessage = | ||
'- [Release notes](https://github.com/fsevents/fsevents/releases)\n' + | ||
'- [Commits](fsevents/[email protected])\n' + | ||
'\n' + | ||
'---\n' + | ||
'updated-dependencies:\n' + | ||
'- dependency-name: fsevents\n' + | ||
' dependency-type: indirect\n' + | ||
'...\n' + | ||
'\n' + | ||
'Signed-off-by: dependabot[bot] <[email protected]>' | ||
|
||
const getAlert = async () => Promise.resolve({ alertState: '', ghsaId: '', cvss: 0 }) | ||
const getScore = async () => Promise.resolve(0) | ||
const updatedDependencies = await updateMetadata.parse(commitMessage, '', 'dependabot-npm_and_yarn-fsevents-1.2.13', 'master', getAlert, getScore) | ||
|
||
expect(updatedDependencies[0].directory).toEqual('/') | ||
}) | ||
|
||
test('it handles branch names with hyphen separator and manifest files in nested directories', async () => { | ||
const commitMessage = | ||
'- [Release notes](https://github.com/fsevents/fsevents/releases)\n' + | ||
'- [Commits](fsevents/[email protected])\n' + | ||
'\n' + | ||
'---\n' + | ||
'updated-dependencies:\n' + | ||
'- dependency-name: fsevents\n' + | ||
' dependency-type: indirect\n' + | ||
'...\n' + | ||
'\n' + | ||
'Signed-off-by: dependabot[bot] <[email protected]>' | ||
|
||
const getAlert = async () => Promise.resolve({ alertState: '', ghsaId: '', cvss: 0 }) | ||
const getScore = async () => Promise.resolve(0) | ||
const updatedDependencies = await updateMetadata.parse(commitMessage, '', 'dependabot-npm_and_yarn-nested-nested-fsevents-1.2.13', 'master', getAlert, getScore) | ||
|
||
expect(updatedDependencies[0].directory).toEqual('/nested/nested') | ||
}) | ||
|
||
test('it handles branch names with hyphen separator and dependency names with forward slashes', async () => { | ||
const commitMessage = | ||
'- [Release notes](https://github.com/composer/composer/releases)\n' + | ||
'- [Changelog](https://github.com/composer/composer/blob/main/CHANGELOG.md)\n' + | ||
'- [Commits](composer/[email protected])\n' + | ||
'\n' + | ||
'---\n' + | ||
'updated-dependencies:\n' + | ||
'- dependency-name: composer/composer\n' + | ||
' dependency-type: indirect\n' + | ||
'...\n' + | ||
'\n' + | ||
'Signed-off-by: dependabot[bot] <[email protected]>' | ||
|
||
const getAlert = async () => Promise.resolve({ alertState: '', ghsaId: '', cvss: 0 }) | ||
const getScore = async () => Promise.resolve(0) | ||
const updatedDependencies = await updateMetadata.parse(commitMessage, '', 'dependabot-composer-composer-composer-2.6.5', 'master', getAlert, getScore) | ||
|
||
expect(updatedDependencies[0].directory).toEqual('/') | ||
}) | ||
|
||
test('calculateUpdateType should handle all paths', () => { | ||
expect(updateMetadata.calculateUpdateType('', '')).toEqual('') | ||
expect(updateMetadata.calculateUpdateType('', '1')).toEqual('') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters