1 import clamp from './clamp';
3 describe('clamp()', () => {
4 it('returns the exact value passed in if it already lies between min & max', () => {
5 expect(clamp(7, 0, 10)).toBe(7);
8 it('returns the min if the value passed in is lower than min', () => {
9 expect(clamp(-2, 0, 10)).toBe(0);
12 it('returns the max if the value passed in is higher than max', () => {
13 expect(clamp(12, 0, 10)).toBe(10);