export default function clamp(value, lower, upper) { throw new Error('Not implemented'); }
import clamp from './clamp'; describe('clamp', () => { test('within range', () => expect(clamp(3, 0, 5)).toBe(3)); test('below lower', () => expect(clamp(-10, -3, 5)).toBe(-3)); test('above upper', () => expect(clamp(10, -5, 5)).toBe(5)); test('on bounds (inclusive)', () => { expect(clamp(0, 0, 5)).toBe(0); expect(clamp(5, 0, 5)).toBe(5); }); });