Skip to content

Commit

Permalink
adding a test for empty PURLs
Browse files Browse the repository at this point in the history
  • Loading branch information
febuiles committed May 31, 2023
1 parent 0b306ae commit 70f8094
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions __tests__/licenses.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]', 'pkg:npm/[email protected]']
}

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 = {
Expand Down

0 comments on commit 70f8094

Please sign in to comment.