Skip to content

Commit 83a6341

Browse files
committed
Handle proper fraction edge cases
1 parent 2eae682 commit 83a6341

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@ test("should return true for a proper fraction", () => {
1111

1212
test("should return false when the numerator and denominator have equal magnitudes", () => {
1313
expect(isProperFraction(5, 5)).toEqual(false);
14+
expect(isProperFraction(-5, 5)).toEqual(false);
15+
expect(isProperFraction(5, -5)).toEqual(false);
1416
expect(isProperFraction(-5, -5)).toEqual(false);
1517
});
1618

1719
test("should return false when the numerator's magnitude exceeds the denominator's", () => {
1820
expect(isProperFraction(7, 3)).toEqual(false);
1921
expect(isProperFraction(-7, 3)).toEqual(false);
22+
expect(isProperFraction(7, -3)).toEqual(false);
23+
expect(isProperFraction(-7, -3)).toEqual(false);
2024
});
2125

2226
test("should return true when numerator is zero", () => {
@@ -39,3 +43,7 @@ test("should return true for positive numerator and negative denominator when th
3943
test("should return false for negative numerator and positive denominator when the numerator is larger", () => {
4044
expect(isProperFraction(-3, 2)).toEqual(false);
4145
});
46+
47+
test("should return false for positive numerator and negative denominator when the numerator is larger", () => {
48+
expect(isProperFraction(3, -2)).toEqual(false);
49+
});

0 commit comments

Comments
 (0)