Skip to content

Commit f9eea26

Browse files
committed
Add test for when numerator is zero for stretch task
1 parent 3766d27 commit f9eea26

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
// write one test at a time, and make it pass, build your solution up methodically
99

1010
function isProperFraction(numerator, denominator) {
11-
if (numerator < denominator) {
11+
if (numerator < denominator && numerator !== 0) {
1212
return true;
1313
} else if (numerator >= denominator) {
1414
return false;
15+
} else if (numerator === 0) {
16+
return false;
1517
}
1618
}
1719

@@ -61,3 +63,5 @@ assertEquals(equalFraction, false);
6163

6264
// Stretch:
6365
// What other scenarios could you test for?
66+
const zeroNumerator = isProperFraction(0, 5);
67+
assertEquals(zeroNumerator, false);

0 commit comments

Comments
 (0)