Skip to content

Commit 67710d6

Browse files
committed
Refactor getCardValue tests into grouped categories
1 parent 356b64f commit 67710d6

File tree

1 file changed

+8
-27
lines changed

1 file changed

+8
-27
lines changed

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

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,18 @@ test("should return 11 for Ace of Spades", () => {
88
});
99

1010
// Case 2: Handle Number Cards (2-10):
11-
test("should return 2 for 2 of hearts", () => {
12-
const twoOfHearts = getCardValue("2♥");
13-
expect(twoOfHearts).toEqual(2)
14-
})
15-
16-
test("should return 10 for 10 of Diamonds", () => {
17-
const tenOfDiamonds = getCardValue("10♦");
18-
expect(tenOfDiamonds).toEqual(10)
11+
test("should return the value of number cards", () => {
12+
expect(getCardValue("2♣")).toEqual(2);
13+
expect(getCardValue("5♠")).toEqual(5);
14+
expect(getCardValue("10♦")).toEqual(10);
1915
});
2016

2117
// Case 3: Handle Face Cards (J, Q, K):
2218

23-
test("should return 10 for Jack of Clubs", () => {
24-
const jackOfClubs = getCardValue("J♣");
25-
expect(jackOfClubs).toEqual(10)
26-
});
27-
28-
test("should return 10 for Queen of Hearts", () => {
29-
const queenOfHearts = getCardValue("Q♥");
30-
expect(queenOfHearts).toEqual(10)
31-
});
32-
33-
test("should return 10 for King of Spades", () => {
34-
const kingOfSpades= getCardValue("K♠");
35-
expect(kingOfSpades).toEqual(10)
36-
});
37-
38-
// Case 4: Handle Ace (A):
39-
test("should return 11 for Ace of Spades", () => {
40-
const aceOfHearts = getCardValue("A♥");
41-
expect(aceOfHearts).toEqual(11);
19+
test("should return 10 for face cards", () => {
20+
expect(getCardValue("J♣")).toEqual(10);
21+
expect(getCardValue("Q♥")).toEqual(10);
22+
expect(getCardValue("K♠")).toEqual(10);
4223
});
4324

4425
// Case 5: Handle Invalid Cards:

0 commit comments

Comments
 (0)