Skip to content

Commit 6ca023a

Browse files
committed
test: add comprehensive Jest tests for isProperFraction function
1 parent 973475f commit 6ca023a

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,20 @@ test("should return true for a proper fraction", () => {
66
expect(isProperFraction(2, 3)).toEqual(true);
77
});
88

9-
// Case 2: Identify Improper Fractions:
9+
test("should return false for an improper fraction (numerator >= denominator)", () => {
10+
expect(isProperFraction(5, 2)).toEqual(false);
11+
expect(isProperFraction(10, 3)).toEqual(false);
12+
expect(isProperFraction(7, 7)).toEqual(false);
13+
});
1014

11-
// Case 3: Identify Negative Fractions:
15+
test("should return true for a negative proper fraction (|numerator| < denominator)", () => {
16+
expect(isProperFraction(-4, 7)).toEqual(true);
17+
expect(isProperFraction(-2, 5)).toEqual(true);
18+
expect(isProperFraction(-1, 10)).toEqual(true);
19+
});
1220

13-
// Case 4: Identify Equal Numerator and Denominator:
21+
test("should return false when numerator equals denominator", () => {
22+
expect(isProperFraction(3, 3)).toEqual(false);
23+
expect(isProperFraction(1, 1)).toEqual(false);
24+
expect(isProperFraction(100, 100)).toEqual(false);
25+
});

0 commit comments

Comments
 (0)