Skip to content

Commit fb96060

Browse files
committed
Add Jest tests for getcardvalue function
1 parent 508372f commit fb96060

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

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

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

1010
// Case 2: Handle Number Cards (2-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);
15+
});
1116
// Case 3: Handle Face Cards (J, Q, K):
12-
// Case 4: Handle Ace (A):
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+
});
22+
1323
// Case 5: Handle Invalid Cards:
24+
test("should throw an error for Invalid card", () => {
25+
expect(() => getCardValue("1♣")).toThrow("Invalid card rank.");
26+
});

0 commit comments

Comments
 (0)