Skip to content

Commit a3879b8

Browse files
committed
complete 2-is-proper-fraction
1 parent 55c05e3 commit a3879b8

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +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) {
12-
return true;
13-
}
11+
return numerator < denominator;
1412
}
1513

1614
// The line below allows us to load the isProperFraction function into tests in other files.
@@ -46,14 +44,18 @@ assertEquals(improperFraction, false);
4644
// target output: true
4745
// 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.
4846
const negativeFraction = isProperFraction(-4, 7);
49-
// ====> complete with your assertion
47+
assertEquals(negativeFraction, true);
5048

5149
// Equal Numerator and Denominator check:
5250
// Input: numerator = 3, denominator = 3
5351
// target output: false
5452
// Explanation: The fraction 3/3 is not a proper fraction because the numerator is equal to the denominator. The function should return false.
5553
const equalFraction = isProperFraction(3, 3);
56-
// ====> complete with your assertion
54+
assertEquals(equalFraction, false);
5755

5856
// Stretch:
5957
// What other scenarios could you test for?
58+
59+
// Explanation: Should return true when numerator is zero
60+
const zeroFraction = isProperFraction(0, 5);
61+
assertEquals(zeroFraction, true);

0 commit comments

Comments
 (0)