Skip to content

Commit 2755b3f

Browse files
committed
wrote tests for get card value function
1 parent 0e18f06 commit 2755b3f

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

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

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

1010
// Case 2: Handle Number Cards (2-10):
11+
test("should return correct value for number cards", () => {
12+
expect(getCardValue("2♣")).toEqual(2);
13+
expect(getCardValue("5♦")).toEqual(5);
14+
expect(getCardValue("10♥")).toEqual(10);
15+
})
1116
// Case 3: Handle Face Cards (J, Q, K):
17+
test("should return 10 for face cards", () => {
18+
expect(getCardValue("J♣")).toEqual(10);
19+
expect(getCardValue("Q♦")).toEqual(10);
20+
expect(getCardValue("K♥")).toEqual(10);
21+
})
1222
// Case 4: Handle Ace (A):
23+
test("should return 11 for Ace cards", () => {
24+
expect(getCardValue("A♣")).toEqual(11);
25+
expect(getCardValue("A♦")).toEqual(11);
26+
expect(getCardValue("A♥")).toEqual(11);
27+
})
1328
// Case 5: Handle Invalid Cards:
29+
test("should return Invalid card rank for invalid cards", () => {
30+
expect(getCardValue("1♣")).toEqual("Invalid card rank.");
31+
expect(getCardValue("11♦")).toEqual("Invalid card rank.");
32+
expect(getCardValue("3")).toEqual("Invalid card rank.");
33+
expect(getCardValue("3😄")).toEqual("Invalid card rank.");
34+
})

0 commit comments

Comments
 (0)