Skip to content

Commit 82d32cb

Browse files
authored
Enhance isProperFraction tests for edge cases
Added tests for special cases of the isProperFraction function.
1 parent 9d3a213 commit 82d32cb

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,15 @@ test(`should return false when negative/positive numerator is greater than the p
2626
expect(isProperFraction(100, 2)).toEqual(false);
2727
expect(isProperFraction(-1, -0)).toEqual(false);
2828
});
29+
// Special case: Since the abs(denominator) is 1, only a numerator of 0 should be proper.
30+
test("should handle denominator of 1", () => {
31+
expect(isProperFraction(1, 1)).toEqual(false);
32+
expect(isProperFraction(2, 1)).toEqual(false);
33+
});
34+
// Special case: proper fraction requires the numerator to be strictly less than the denominator (in absolute value).
35+
test("should return false when numerator equals denominator", () => {
36+
expect(isProperFraction(5, 5)).toEqual(false);
37+
expect(isProperFraction(-5, 5)).toEqual(false);
38+
expect(isProperFraction(5, -5)).toEqual(false);
39+
expect(isProperFraction(-5, -5)).toEqual(false);
40+
});

0 commit comments

Comments
 (0)