|
1 | | -// This statement loads the isProperFraction function you wrote in the implement directory. |
2 | | -// We will use the same function, but write tests for it using Jest in this file. |
3 | 1 | const isProperFraction = require("../implement/2-is-proper-fraction"); |
4 | 2 |
|
5 | 3 | test("should return true for a proper fraction", () => { |
6 | 4 | expect(isProperFraction(2, 3)).toEqual(true); |
7 | 5 | }); |
8 | 6 |
|
9 | | -// Case 2: Identify Improper Fractions: |
| 7 | +test("should return false for an improper fraction (numerator >= denominator)", () => { |
| 8 | + expect(isProperFraction(5, 2)).toEqual(false); |
| 9 | + expect(isProperFraction(10, 3)).toEqual(false); |
| 10 | + expect(isProperFraction(7, 7)).toEqual(false); |
| 11 | +}); |
10 | 12 |
|
11 | | -// Case 3: Identify Negative Fractions: |
| 13 | +test("should return true for a negative proper fraction (|numerator| < denominator)", () => { |
| 14 | + expect(isProperFraction(-4, 7)).toEqual(true); |
| 15 | + expect(isProperFraction(-2, 5)).toEqual(true); |
| 16 | + expect(isProperFraction(-1, 10)).toEqual(true); |
| 17 | +}); |
12 | 18 |
|
13 | | -// Case 4: Identify Equal Numerator and Denominator: |
| 19 | +test("should return false when numerator equals denominator", () => { |
| 20 | + expect(isProperFraction(3, 3)).toEqual(false); |
| 21 | + expect(isProperFraction(1, 1)).toEqual(false); |
| 22 | + expect(isProperFraction(100, 100)).toEqual(false); |
| 23 | +}); |
0 commit comments