actions/sources/test/jest/configuration.test.ts
Sebastiaan de Schaetzen b3863e10a2
Some checks failed
CI-integ-test-full / caching-integ-tests (push) Failing after 32s
CI-integ-test-full / other-integ-tests (push) Failing after 29m15s
CI-codeql / Analyze (javascript-typescript) (push) Failing after 1m30s
Update Wrapper checksums file / Update checksums (push) Failing after 1m28s
Initial commit
2024-09-25 17:07:42 +02:00

23 lines
784 B
TypeScript

import * as inputParams from '../../src/configuration'
describe('input params', () => {
describe('parses numeric input', () => {
it('uses default value', () => {
const val = inputParams.parseNumericInput('param-name', '', 88)
expect(val).toBe(88)
})
it('parses numeric input', () => {
const val = inputParams.parseNumericInput('param-name', '34', 88)
expect(val).toBe(34)
})
it('fails on non-numeric input', () => {
const t = () => {
inputParams.parseNumericInput('param-name', 'xyz', 88)
};
expect(t).toThrow(TypeError)
expect(t).toThrow("The value 'xyz' is not a valid numeric value for 'param-name'.")
})
})
})