|
1 | 1 | import { isProperFraction } from "../implement/2-is-proper-fraction.js"; |
2 | 2 |
|
3 | 3 | // TODO: Write tests in Jest syntax to cover all combinations of positives, negatives, zeros, and other categories. |
4 | | -test(`should return true for proper fractions`, () => { |
| 4 | +test("should return true for proper fractions", () => { |
5 | 5 | expect(isProperFraction(1, 2)).toEqual(true); |
6 | 6 | expect(isProperFraction(2, 5)).toEqual(true); |
7 | 7 | }); |
8 | 8 |
|
9 | | -test(`should return false when numerator is not smaller`, () => { |
| 9 | +test("should return false when numerator is not smaller", () => { |
10 | 10 | expect(isProperFraction(5, 5)).toEqual(false); |
11 | 11 | expect(isProperFraction(7, 5)).toEqual(false); |
12 | 12 | }); |
13 | 13 |
|
14 | | -// Special case: numerator is zero |
15 | | -test(`should return false when denominator is zero`, () => { |
| 14 | +test("should return false when denominator is zero", () => { |
16 | 15 | expect(isProperFraction(1, 0)).toEqual(false); |
| 16 | + expect(isProperFraction(0, 0)).toEqual(false); |
17 | 17 | }); |
18 | 18 |
|
19 | | -test(`should return true when numerator is zero`, () => { |
| 19 | +test("should return true when numerator is zero", () => { |
20 | 20 | expect(isProperFraction(0, 5)).toEqual(true); |
21 | 21 | }); |
| 22 | + |
| 23 | +test("should handle negative numerators", () => { |
| 24 | + expect(isProperFraction(-2, 5)).toEqual(true); |
| 25 | + expect(isProperFraction(-5, 2)).toEqual(false); |
| 26 | +}); |
| 27 | + |
| 28 | +test("should handle negative denominators", () => { |
| 29 | + expect(isProperFraction(2, -5)).toEqual(true); |
| 30 | + expect(isProperFraction(5, -2)).toEqual(false); |
| 31 | +}); |
| 32 | + |
| 33 | +test("should handle negative numerators and denominators", () => { |
| 34 | + expect(isProperFraction(-2, -5)).toEqual(true); |
| 35 | + expect(isProperFraction(-5, -2)).toEqual(false); |
| 36 | +}); |
0 commit comments