Skip to content

Commit a31ba23

Browse files
committed
to answer getcardvalue
1 parent 5a30847 commit a31ba23

File tree

1 file changed

+33
-4
lines changed

1 file changed

+33
-4
lines changed

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

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,36 @@ test("should return 11 for Ace of Spades", () => {
77
expect(aceofSpades).toEqual(11);
88
});
99

10-
// Case 2: Handle Number Cards (2-10):
11-
// Case 3: Handle Face Cards (J, Q, K):
12-
// Case 4: Handle Ace (A):
13-
// Case 5: Handle Invalid Cards:
10+
test("should return card value for number cards", () => {
11+
const fiveofHearts = getCardValue("5♥");
12+
expect(fiveofHearts).toEqual(5);
13+
});
14+
15+
test("should return 10 for 10 card", () => {
16+
const ten = getCardValue("10♦");
17+
expect(ten).toEqual(10);
18+
});
19+
20+
test("should return 10 for jack card", () => {
21+
const jack = getCardValue("J♦");
22+
expect(jack).toEqual(10);
23+
});
24+
25+
test("should return 10 for queen card", () => {
26+
const queen = getCardValue("Q♠");
27+
expect(queen).toEqual(10);
28+
});
29+
30+
test("should return 10 for king card", () => {
31+
const king = getCardValue("K♥");
32+
expect(king).toEqual(10);
33+
});
34+
35+
test("should return 11 for the ace cards", () => {
36+
const ace = getCardValue("A♥");
37+
expect(ace).toEqual(11);
38+
});
39+
40+
test("should throw an error for invalid card rank", () => {
41+
expect(() => getCardValue("Z♥")).toThrow("Invalid card rank");
42+
});

0 commit comments

Comments
 (0)