Skip to content
Open
Prev Previous commit
Next Next commit
removed-redundant-else, fixed-typo, improved tests names
  • Loading branch information
Elisabeth-Matulian committed Mar 2, 2026
commit 9e2dc09698482d012d01745ed9fe7b4c2e329dee
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ function isProperFraction(numerator, denominator) {
if (denominator === 0) {
return false;
}
else {
return Math.abs(numerator) < Math.abs(denominator);
}
return Math.abs(numerator) < Math.abs(denominator);
}
``

// The line below allows us to load the isProperFraction function into tests in other files.
// This will be useful in the "rewrite tests with jest" step.
module.exports = isProperFraction;
Expand All @@ -44,5 +42,4 @@ assertEquals(isProperFraction(-2, 5), true);
assertEquals(isProperFraction(5, -2), false);
assertEquals(isProperFraction(5, 5), false);
assertEquals(isProperFraction(5, 0), false);
assertEquals(isProperFraction(-2, 0), false);
``
assertEquals(isProperFraction(-2, 0), false);
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ test(`should return true when numerator is less than denominator`, () => {
test(`should return false when numerator is greater than denominator`, () => {
expect(isProperFraction(7, 1)).toEqual(false);
});
test(`should return true when numerator is 0`, () => {
test(`should return true when numerator is 0 and denominator is positive`, () => {
expect(isProperFraction(0, 5)).toEqual(true);
});
test(`should return true when numerator and denominator are negative`, () => {
Expand All @@ -32,9 +32,9 @@ test(`should return false when numerator is positive and denominator is negative
test(`should return false when numerator equals denominator`, () => {
expect(isProperFraction(5, 5)).toEqual(false);
});
test(`should return false when denominator is 0`, () => {
test(`should return false when denominator is 0 and nominator is positive`, () => {
expect(isProperFraction(5, 0)).toEqual(false);
});
test(`should return false when denominator is 0`, () => {
test(`should return false when denominator is 0 and nominator is negative`, () => {
expect(isProperFraction(-2, 0)).toEqual(false);
});
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ test(`Should return Error when given an 11♦`, () => {
expect(function() {getCardValue("11♦")}).toThrow("Invalid card");
});
test(`Should return Error when given an AX`, () => {
expect(function() {getCardValue("11♦")}).toThrow("Invalid card");
expect(function() {getCardValue("AX")}).toThrow("Invalid card");
});


Expand Down