Skip to content

Commit 70f8094

Browse files
author
Federico Builes
committed
adding a test for empty PURLs
1 parent 0b306ae commit 70f8094

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

__tests__/licenses.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,23 @@ test('it does not filter out changes that are on the exclusions list', async ()
192192
expect(invalidLicenses.forbidden.length).toEqual(0)
193193
})
194194

195+
test('it does not fail when the packages dont have a valid PURL', async () => {
196+
const emptyPurlChange = pipChange
197+
emptyPurlChange.package_url = ''
198+
199+
const changes: Changes = [emptyPurlChange, npmChange, rubyChange]
200+
const licensesConfig = {
201+
allow: ['BSD'],
202+
licenseExclusions: ['pkg:pip/[email protected]', 'pkg:npm/[email protected]']
203+
}
204+
205+
const invalidLicenses = await getInvalidLicenseChanges(
206+
changes,
207+
licensesConfig
208+
)
209+
expect(invalidLicenses.forbidden.length).toEqual(1)
210+
})
211+
195212
test('it does filters out changes if they are not on the exclusions list', async () => {
196213
const changes: Changes = [pipChange, npmChange, rubyChange]
197214
const licensesConfig = {

0 commit comments

Comments
 (0)