diff --git a/__tests__/config.test.ts b/__tests__/config.test.ts index 082cd67..dbf3aa0 100644 --- a/__tests__/config.test.ts +++ b/__tests__/config.test.ts @@ -67,6 +67,13 @@ test('it raises an error if both an allow and denylist are specified', async () 'You cannot specify both allow-licenses and deny-licenses' ) }) +test('it raises an error if an empty allow list is specified', async () => { + setInput('config-file', './__tests__/fixtures/config-empty-allow-sample.yml') + + await expect(readConfig()).rejects.toThrow( + 'You should provide at least one license in allow-licenses' + ) +}) test('it raises an error when given an unknown severity', async () => { setInput('fail-on-severity', 'zombies') diff --git a/__tests__/fixtures/config-empty-allow-sample.yml b/__tests__/fixtures/config-empty-allow-sample.yml new file mode 100644 index 0000000..1e7f078 --- /dev/null +++ b/__tests__/fixtures/config-empty-allow-sample.yml @@ -0,0 +1,2 @@ +fail_on_severity: critical +allow_licenses: [] diff --git a/__tests__/licenses.test.ts b/__tests__/licenses.test.ts index 27c5fc5..9cc2cae 100644 --- a/__tests__/licenses.test.ts +++ b/__tests__/licenses.test.ts @@ -99,17 +99,6 @@ test('it adds license inside the deny list to forbidden changes', async () => { expect(forbidden.length).toEqual(1) }) -// This is more of a "here's a behavior that might be surprising" than an actual -// thing we want in the system. Please remove this test after refactoring. -test('it adds all licenses to forbidden changes when allow is provided an empty array', async () => { - const changes: Changes = [npmChange, rubyChange] - let {forbidden} = await getInvalidLicenseChanges(changes, { - allow: [], - deny: ['BSD'] - }) - expect(forbidden.length).toBe(2) -}) - test('it does not add license outside the allow list to forbidden changes if it is in removed changes', async () => { const changes: Changes = [ {...npmChange, change_type: 'removed'},