import { getMid, getNumberWithinConstraints, } from './numbers'; describe('getMid', () => { test('Gets the mid point from an array of points', () => { const points = [0, 2, 10]; const mid = getMid(points); expect(mid).toBe(5); }); }); describe('getNumberWithinConstraints', () => { // tslint:disable-next-line test('Gets the maximum constraint if the number is beyond the maximum', () => { const result = getNumberWithinConstraints( 11, 0, 10, ); expect(result).toBe(10); }); // tslint:disable-next-line test('Gets the minimum constraint if the number is below the minimum', () => { const result = getNumberWithinConstraints( -1, 0, 10, ); expect(result).toBe(0); }); test('Gets the number if it sits within the constraints', () => { const result = getNumberWithinConstraints( 1, 0, 10, ); expect(result).toBe(1); }); });