diff --git a/__tests__/config.test.ts b/__tests__/config.test.ts index 63eb7d5..8e0203c 100644 --- a/__tests__/config.test.ts +++ b/__tests__/config.test.ts @@ -15,6 +15,7 @@ function clearInputs() { 'FAIL-ON-SEVERITY', 'ALLOW-LICENSES', 'DENY-LICENSES', + 'CONFIG-FILE', 'BASE-REF', 'HEAD-REF' ] @@ -92,3 +93,15 @@ test('it reads an external config file', async () => { test('raises an error when the the config file was not found', async () => { expect(() => readConfigFile('fixtures/i-dont-exist')).toThrow() }) + +test('in case of conflicts, the external file is the source of truth', async () => { + setInput('config-file', 'true') // this will set fail-on-severity to 'low' + + let options = readConfig() + expect(options.fail_on_severity).toEqual('low') + + // this should not overwite the previous value + setInput('fail-on-severity', 'critical') + options = readConfig() + expect(options.fail_on_severity).toEqual('low') +})