Skip to content

Commit 463d531

Browse files
added tests for handling number cards and face cards in getCardValue function
1 parent 3143f7e commit 463d531

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

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

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

1010
// Case 2: Handle Number Cards (2-10):
11+
test("should return 3 for 3 of Spades", () => {
12+
const threeOfSpades = getCardValue("3♠");
13+
expect(threeOfSpades).toEqual(3);
14+
});
15+
1116
// Case 3: Handle Face Cards (J, Q, K):
17+
test("should return 10 for Jack of Spades", () => {
18+
const jackOfSpades = getCardValue("J♠");
19+
expect(jackOfSpades).toEqual(10);
20+
});
21+
1222
// Case 4: Handle Ace (A):
23+
test("should return 11 for Ace of Spades", () => {
24+
const aceofSpades = getCardValue("A♠");
25+
expect(aceofSpades).toEqual(11);
26+
});
27+
1328
// Case 5: Handle Invalid Cards:
29+
test("should return invalid card for g of spades", () => {
30+
const gOfSpades = getCardValue("g♠");
31+
expect(gOfSpades).toEqual("Invalid card rank.");
32+
});

0 commit comments

Comments
 (0)