Skip to content

Commit 595eed1

Browse files
added assert for incomplete fraction
1 parent 649826a commit 595eed1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
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) return "Incomplete fraction";
1112
if (typeof numerator !== "number" || typeof denominator !== "number")
1213
return "Use only numbers";
1314

@@ -87,3 +88,6 @@ assertEquals(notANumber, "Use only numbers");
8788
//Explanation: the fraction only takes numbers
8889
const notANumber2 = isProperFraction(7, "q");
8990
assertEquals(notANumber2, "Use only numbers");
91+
92+
const incompleteFraction = isProperFraction(2);
93+
assertEquals(incompleteFraction, "Incomplete fraction");

0 commit comments

Comments
 (0)