renovate/lib/util/number.spec.ts
2023-09-06 13:35:52 +00:00

12 lines
380 B
TypeScript

import { coerceNumber } from './number';
describe('util/number', () => {
it.each`
val | def | expected
${1} | ${2} | ${1}
${undefined} | ${2} | ${2}
${undefined} | ${undefined} | ${0}
`('coerceNumber($val, $def) = $expected', ({ val, def, expected }) => {
expect(coerceNumber(val, def)).toBe(expected);
});
});