Skip to content

Commit 5fb6f95

Browse files
fix: add missing assertions for negative and equal fraction checks
1 parent 487694e commit 5fb6f95

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,10 @@
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) {
12-
return true;
13-
}
11+
if (numerator < denominator) return true;
12+
else return false;
1413
}
1514

16-
// The line below allows us to load the isProperFraction function into tests in other files.
17-
// This will be useful in the "rewrite tests with jest" step.
18-
module.exports = isProperFraction;
19-
2015
// here's our helper again
2116
function assertEquals(actualOutput, targetOutput) {
2217
console.assert(
@@ -47,13 +42,15 @@ assertEquals(improperFraction, false);
4742
// Explanation: The fraction -4/7 is a proper fraction because the absolute value of the numerator (4) is less than the denominator (7). The function should return true.
4843
const negativeFraction = isProperFraction(-4, 7);
4944
// ====> complete with your assertion
45+
assertEquals(properFraction, true);
5046

5147
// Equal Numerator and Denominator check:
5248
// Input: numerator = 3, denominator = 3
5349
// target output: false
5450
// Explanation: The fraction 3/3 is not a proper fraction because the numerator is equal to the denominator. The function should return false.
5551
const equalFraction = isProperFraction(3, 3);
5652
// ====> complete with your assertion
53+
assertEquals(equalFraction, false)
5754

5855
// Stretch:
5956
// What other scenarios could you test for?

0 commit comments

Comments
 (0)