Skip to content

Commit e2c54d6

Browse files
committed
Update: fix test cases in getCardValue to improve readability and consistency
1 parent a52f2c1 commit e2c54d6

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed
Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,27 @@
11
const getCardValue = require("./3-get-card-value");
22

33
test("should return 11 for Ace of Spades", () => {
4-
const aceofSpades = getCardValue("A♠");
5-
expect(aceofSpades).toEqual(11);
6-
});
4+
const aceofSpades = getCardValue("A♠");
5+
expect(aceofSpades).toEqual(11);
6+
});
77

88
// Case 2: Handle Number Cards (2-10):
9+
test("should return 7 for 7 of Hearts", () => {
10+
const sevenOfHearts = getCardValue("7♥");
11+
expect(sevenOfHearts).toEqual(7);
12+
});
913
// Case 3: Handle Face Cards (J, Q, K):
14+
test("should return 10 for King of Diamonds", () => {
15+
const kingOfDiamonds = getCardValue("K♦");
16+
expect(kingOfDiamonds).toEqual(10);
17+
});
1018
// Case 4: Handle Ace (A):
19+
test("should return 11 for Ace of Clubs", () => {
20+
const aceOfClubs = getCardValue("A♣");
21+
expect(aceOfClubs).toEqual(11);
22+
});
1123
// Case 5: Handle Invalid Cards:
24+
test("should return 0 for invalid card 'X♠'", () => {
25+
const invalidCard = getCardValue("X♠");
26+
expect(invalidCard).toEqual(0);
27+
});

0 commit comments

Comments
 (0)