Skip to content

Commit 6060395

Browse files
committed
fun with fractions
1 parent 0741973 commit 6060395

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
// execute the code to ensure all tests pass.
1212

1313
function isProperFraction(numerator, denominator) {
14-
numerator = Math.sign(numerator) * Math.abs(numerator);
15-
return (numerator < denominator )
14+
return (Math.abs(numerator) < denominator )
1615
}
1716

1817
// The line below allows us to load the isProperFraction function into tests in other files.

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ test(`Should return a true when the (numerator < denominator)`,()=>{
2525
});
2626
test(`Should return the correct answer for negative numerators (numerator < denominator)`,()=>{
2727
expect(isProperFraction(-1,2)).toEqual(true)
28-
expect(isProperFraction(-100,2)).toEqual(true)
2928
expect(isProperFraction(-7,8)).toEqual(true)
29+
expect(isProperFraction(-100,2)).toEqual(false)
30+
expect(isProperFraction(-60,10)).toEqual(false)
31+
expect(isProperFraction(-5,4)).toEqual(false)
32+
3033

3134
});

0 commit comments

Comments
 (0)