Skip to content

Commit 9a65372

Browse files
committed
test: enhance isProperFraction tests for edge cases and clarify descriptions
1 parent 07732b4 commit 9a65372

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,30 @@ const isProperFraction = require("../implement/2-is-proper-fraction");
88
test(`should return false when denominator is zero`, () => {
99
expect(isProperFraction(1, 0)).toEqual(false);
1010
expect(isProperFraction(2, 0)).toEqual(false);
11+
expect(isProperFraction(-4, 0)).toEqual(false);
12+
1113

1214
});
1315

1416
// Case 2: Denominator is greater than numerator
15-
test(`should return true when denominator is greater than numerator`, () => {
17+
test(`should return true when absolute value of denominator is greater than absolute value of numerator`, () => {
1618
expect(isProperFraction(1, 2)).toEqual(true);
1719
expect(isProperFraction(2, 4)).toEqual(true);
1820
expect(isProperFraction(3, 6)).toEqual(true);
1921
expect(isProperFraction(4, 8)).toEqual(true);
2022
expect(isProperFraction(5, 10)).toEqual(true);
23+
expect(isProperFraction(-1, 2)).toEqual(true);
24+
expect(isProperFraction(2, -4)).toEqual(true);
25+
expect(isProperFraction(-3, -6)).toEqual(true);
26+
expect(isProperFraction(0, 5)).toEqual(true);
2127
});
2228

2329
// Case 3: Denominator is less than numerator
24-
test(`should return false when denominator is less than numerator`, () => {
30+
test(`should return false when absolute value of denominator is less than absolute value of numerator`, () => {
2531
expect(isProperFraction(2, 1)).toEqual(false);
2632
expect(isProperFraction(4, 2)).toEqual(false);
2733
expect(isProperFraction(6, 3)).toEqual(false);
2834
expect(isProperFraction(8, 4)).toEqual(false);
2935
expect(isProperFraction(10, 5)).toEqual(false);
36+
expect(isProperFraction(-5, 4)).toEqual(false);
3037
});

0 commit comments

Comments
 (0)