1 import percentage from './percentage';
3 describe('percentage()', () => {
4 it('returns the percentage between an entire and a fraction', () => {
5 const output = percentage(500, 100);
7 expect(output).toBe(20);
10 it("returns a decimal in case the percentage can't be resolved in integers", () => {
11 const output = percentage(30, 10);
13 expect(Math.round(output)).not.toBe(output);
16 it('returns 0 if either inputs are 0', () => {
17 expect(percentage(0, 1)).toBe(0);
18 expect(percentage(1, 0)).toBe(0);