Skip to content

Commit 9e2dc09

Browse files
removed-redundant-else, fixed-typo, improved tests names
1 parent 6874b2e commit 9e2dc09

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@ function isProperFraction(numerator, denominator) {
1414
if (denominator === 0) {
1515
return false;
1616
}
17-
else {
18-
return Math.abs(numerator) < Math.abs(denominator);
19-
}
17+
return Math.abs(numerator) < Math.abs(denominator);
2018
}
21-
``
19+
2220
// The line below allows us to load the isProperFraction function into tests in other files.
2321
// This will be useful in the "rewrite tests with jest" step.
2422
module.exports = isProperFraction;
@@ -44,5 +42,4 @@ assertEquals(isProperFraction(-2, 5), true);
4442
assertEquals(isProperFraction(5, -2), false);
4543
assertEquals(isProperFraction(5, 5), false);
4644
assertEquals(isProperFraction(5, 0), false);
47-
assertEquals(isProperFraction(-2, 0), false);
48-
``
45+
assertEquals(isProperFraction(-2, 0), false);

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ test(`should return true when numerator is less than denominator`, () => {
1414
test(`should return false when numerator is greater than denominator`, () => {
1515
expect(isProperFraction(7, 1)).toEqual(false);
1616
});
17-
test(`should return true when numerator is 0`, () => {
17+
test(`should return true when numerator is 0 and denominator is positive`, () => {
1818
expect(isProperFraction(0, 5)).toEqual(true);
1919
});
2020
test(`should return true when numerator and denominator are negative`, () => {
@@ -32,9 +32,9 @@ test(`should return false when numerator is positive and denominator is negative
3232
test(`should return false when numerator equals denominator`, () => {
3333
expect(isProperFraction(5, 5)).toEqual(false);
3434
});
35-
test(`should return false when denominator is 0`, () => {
35+
test(`should return false when denominator is 0 and nominator is positive`, () => {
3636
expect(isProperFraction(5, 0)).toEqual(false);
3737
});
38-
test(`should return false when denominator is 0`, () => {
38+
test(`should return false when denominator is 0 and nominator is negative`, () => {
3939
expect(isProperFraction(-2, 0)).toEqual(false);
4040
});

Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ test(`Should return Error when given an 11♦`, () => {
2727
expect(function() {getCardValue("11♦")}).toThrow("Invalid card");
2828
});
2929
test(`Should return Error when given an AX`, () => {
30-
expect(function() {getCardValue("11♦")}).toThrow("Invalid card");
30+
expect(function() {getCardValue("AX")}).toThrow("Invalid card");
3131
});
3232

3333

0 commit comments

Comments
 (0)