Add more test for added and removed pattern

This commit is contained in:
Kenichi Kamiya
2022-07-13 19:07:12 +09:00
parent ae4118f8fa
commit c003e7f8fc
+10
View File
@@ -86,3 +86,13 @@ test('it does not fail if a license inside the deny list is found in removed cha
const [invalidChanges, _] = getDeniedLicenseChanges(changes, {deny: ['BSD']})
expect(invalidChanges).toStrictEqual([])
})
test('it fails if a license outside the allow list is found in both of added and removed changes', async () => {
const changes: Changes = [
{...npmChange, change_type: 'removed'},
npmChange,
{...rubyChange, change_type: 'removed'}
]
const [invalidChanges, _] = getDeniedLicenseChanges(changes, {allow: ['BSD']})
expect(invalidChanges).toStrictEqual([npmChange])
})