diff --git a/__tests__/licenses.test.ts b/__tests__/licenses.test.ts index ae9f3f0..5cd5c0c 100644 --- a/__tests__/licenses.test.ts +++ b/__tests__/licenses.test.ts @@ -192,6 +192,23 @@ test('it does not filter out changes that are on the exclusions list', async () expect(invalidLicenses.forbidden.length).toEqual(0) }) +test('it does not fail when the packages dont have a valid PURL', async () => { + const emptyPurlChange = pipChange + emptyPurlChange.package_url = '' + + const changes: Changes = [emptyPurlChange, npmChange, rubyChange] + const licensesConfig = { + allow: ['BSD'], + licenseExclusions: ['pkg:pip/package-1@1.1.1', 'pkg:npm/reeuhq@1.0.2'] + } + + const invalidLicenses = await getInvalidLicenseChanges( + changes, + licensesConfig + ) + expect(invalidLicenses.forbidden.length).toEqual(1) +}) + test('it does filters out changes if they are not on the exclusions list', async () => { const changes: Changes = [pipChange, npmChange, rubyChange] const licensesConfig = {