Adding more tests for the config file.

This commit is contained in:
Federico Builes
2022-09-19 17:29:25 +02:00
parent 4b4ec08f7b
commit 3c95902dd6

View File

@@ -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')
})