16 lines
440 B
TypeScript
16 lines
440 B
TypeScript
import constrainNumeric from './constrainNumeric';
|
|
|
|
describe('constrainNumeric', () => {
|
|
it('constrains the value when it is less than 0', () => {
|
|
expect(constrainNumeric(-1, 10)).toEqual(0);
|
|
});
|
|
|
|
it('constrains the value when it is greater than max', () => {
|
|
expect(constrainNumeric(11, 10)).toEqual(10);
|
|
});
|
|
|
|
it('does not constrain an acceptable value', () => {
|
|
expect(constrainNumeric(3, 10)).toEqual(3);
|
|
});
|
|
});
|