import { transformNumberToRating } from './transformNumberToRating'; describe('#transformNumberToRating', () => { test.each([ [NaN, null], [-1, null], [0, null], [0.1, null], [0.5, 1], [1, 1], [5.1, 5], [5.5, 6], [10, 10], [100, 10], [100.123, 10], ])('should parse %p to %p', (input, output) => { expect(transformNumberToRating({ numberValue: input, ratingMax: 10 })).toBe( output ); }); });