import { getRating, roundHalf } from './rating';

describe('Rating Helper', () => {
  test('roundHalf()', () => {
    expect(roundHalf(3.24)).toEqual(3);
    expect(roundHalf(3.25)).toEqual(3.5);
    expect(roundHalf(3.74)).toEqual(3.5);
    expect(roundHalf(3.75)).toEqual(4);
  });

  test('getRating()', () => {
    expect(getRating([5, 6, 7, 6.3])).toEqual(6);
    expect(getRating(3.75)).toEqual(4);
  });
});
