Skip to content

Commit b8ab592

Browse files
committed
test: enhance isProperFraction function to handle zero numerator and denominator cases
1 parent 580d40f commit b8ab592

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,10 @@
1212

1313
function isProperFraction(numerator, denominator) {
1414

15-
if(denominator === 0){
15+
if(denominator === 0 || numerator === 0){
1616
return false
1717
}
1818

19-
if (typeof numerator !== "number" || typeof denominator !== "number") {
20-
return false;
21-
}
22-
2319
if (numerator < 0) {
2420
numerator = numerator * -1;
2521
}
@@ -58,6 +54,4 @@ assertEquals(isProperFraction(-3, -5), true);
5854
// Example: 3/2 is a improper fraction
5955
assertEquals(isProperFraction(3, 0), false);
6056
assertEquals(isProperFraction(-7, 5), false);
61-
assertEquals(isProperFraction(5, "-36"), false);
62-
assertEquals(isProperFraction("-8", 5), false);
6357
console.log("✓ All test executed!");

0 commit comments

Comments
 (0)