Skip to content

Commit c48508e

Browse files
committed
Fixed errors
1 parent 6450496 commit c48508e

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,17 @@ assertEquals(equalFraction, false);
6161
// Explanation: The fraction 0/5 is a proper fraction because the numerator (0) is less than the denominator (5). The function should return true.
6262
const zeroNumerator = isProperFraction(0, 5);
6363
assertEquals(zeroNumerator, true);
64+
65+
// Negative Numerator check:
66+
// Input: numerator = -3, denominator = 4
67+
// target output: true
68+
// Explanation: The fraction -3/4 is a proper fraction because the absolute value of numerator (3) is less than denominator (4)
69+
const negativeNumerator = isProperFraction(-3, 4);
70+
assertEquals(negativeNumerator, true);
71+
72+
// Equal Values check:
73+
// Input: numerator = 7, denominator = 7
74+
// target output: false
75+
// Explanation: The fraction 7/7 is NOT a proper fraction because the numerator equals the denominator (not less than)
76+
const equalValues = isProperFraction(7, 7);
77+
assertEquals(equalValues, false);

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ const cardOfQ = getCardValue("Q♠");
6565
assertEquals(cardOfQ, 10);
6666
const cardOfK = getCardValue("K♠");
6767
assertEquals(cardOfK, 10);
68+
const cardOf10 = getCardValue("10♣");
69+
assertEquals(cardOf10, 10);
6870

6971

7072
// Handle Ace (A):

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,21 @@ test("should return correct value for number cards", () => {
1414
});
1515

1616
// Case 3: Handle Face Cards (J, Q, K):
17-
test("Case 3: Handle Face Cards (J, Q, K)", () => {
17+
test("Case 3: Handle Face Card (J)", () => {
1818
const cardOfJ = getCardValue("J♥");
1919
expect(cardOfJ).toEqual(10);
2020
});
21+
test("Case 3: Handle Face Cards (Q)", () => {
22+
const cardOfQ = getCardValue("Q♠");
23+
expect(cardOfQ).toEqual(10);
24+
});
25+
test("Case 3: Handle Face Cards (K)", () => {
26+
const cardOfK = getCardValue("K♠");
27+
expect(cardOfK).toEqual(10);
28+
});
2129

2230
// Case 4: Handle Ace (A):
23-
test("Case 4: Handle Face Cards (J, Q, K)", () => {
31+
test("Case 4: Handle Face Cards (A)", () => {
2432
const aceOfHeart = getCardValue("A♥");
2533
expect(aceOfHeart).toEqual(11);
2634
});
@@ -30,4 +38,10 @@ test("Case 5: Handle Invalid Cards", () => {
3038
expect(() => {
3139
getCardValue("21♠");
3240
}).toThrow("Invalid card rank");
41+
});
42+
43+
test("Case 6: Handle card with invalid rank", () => {
44+
expect(() => {
45+
getCardValue("ZC");
46+
}).toThrow("Invalid card rank");
3347
});

0 commit comments

Comments
 (0)