-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: validation logic of cocoapods purls
- Loading branch information
1 parent
2f3203e
commit 87159ad
Showing
2 changed files
with
65 additions
and
0 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
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 |
---|---|---|
|
@@ -88,6 +88,58 @@ describe('validatePackageURL', () => { | |
}); | ||
}); | ||
|
||
describe('cocoapods Purl type tests', () => { | ||
it.each([ | ||
[ | ||
'cocoapods package without subspec', | ||
{ | ||
name: 'bar', | ||
version: '1.2.3', | ||
purl: 'pkg:cocoapods/[email protected]', | ||
}, | ||
], | ||
[ | ||
'cocoapods package with subspec', | ||
{ | ||
name: 'spec/subspec', | ||
version: '1.2.3', | ||
purl: 'pkg:cocoapods/[email protected]#subspec', | ||
}, | ||
], | ||
])('validates cocoapods Purls: %s', (name, pkg) => { | ||
expect(() => validatePackageURL(pkg)).not.toThrow(); | ||
}); | ||
|
||
it.each([ | ||
[ | ||
'package name does not match purl name', | ||
{ | ||
name: 'foo', | ||
version: '1.2.3', | ||
purl: 'pkg:cocoapods/[email protected]', | ||
}, | ||
], | ||
[ | ||
'package name does not match subspec', | ||
{ | ||
name: 'baz/foo', | ||
version: '1.2.3', | ||
purl: 'pkg:cocoapods/[email protected]#bar', | ||
}, | ||
], | ||
[ | ||
'package name does not include subspec', | ||
{ | ||
name: 'bar', | ||
version: '1.2.3', | ||
purl: 'pkg:cocoapods/[email protected]#baz', | ||
}, | ||
], | ||
])('should throw on invalid purl: %s', (name, pkg) => { | ||
expect(() => validatePackageURL(pkg)).toThrow(); | ||
}); | ||
}); | ||
|
||
describe('composer Purl type tests', () => { | ||
it.each([ | ||
[ | ||
|