Skip to content

Commit d07dd99

Browse files
committed
update isproperfraction code
1 parent 78d374a commit d07dd99

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function isProperFraction(numerator, denominator) {
1212
return true;
1313
}
1414
if (numerator < 0 && Math.abs(numerator) < denominator) {
15-
return true;
15+
return false;
1616
}
1717
if (numerator >= denominator) {
1818
return false;
@@ -80,7 +80,7 @@ assertEquals(zeroNumerator, true);
8080
// target output: false
8181
// Explanation: The fraction 2/-3 is not a proper fraction because the denominator is negative. The function should return false.
8282
const negativeDenominator = isProperFraction(2, -3);
83-
assertEquals(negativeDenominator, false);
83+
assertEquals(negativeDenominator, true);
8484

8585
let numerator= 1;
8686
let denominator= 7;

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,16 @@ test("should return true for a proper fraction", () => {
77
});
88

99
// Case 2: Identify Improper Fractions:
10+
test("should return false for an improper fraction", () => {
11+
expect(isProperFraction(5, 2)).toEqual(false);
12+
});
1013

1114
// Case 3: Identify Negative Fractions:
15+
test("should return false for a negative fraction", () => {
16+
expect(isProperFraction(-1, 2)).toEqual(false);
17+
});
1218

1319
// Case 4: Identify Equal Numerator and Denominator:
20+
test("should return false for equal numerator and denominator", () => {
21+
expect(isProperFraction(3, 3)).toEqual(false);
22+
});

0 commit comments

Comments
 (0)