Skip to content

Commit 8c717df

Browse files
committed
Add more Jest test cases for getCardValue implementation
1 parent 69ddec4 commit 8c717df

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

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

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

1010
// Case 2: Handle Number Cards (2-10):
11-
// test("should return 10 for number cards from 1 to 10", () => {
12-
// const numberCards = getCardValue("8♥");
13-
// expect(numberCards.toEqual(10));
14-
// })
11+
test("should return the numeric value for number cards from 2 to 10", () => {
12+
const numberCard = getCardValue("7♥");
13+
expect(numberCard).toEqual(7);
14+
})
1515
// Case 3: Handle Face Cards (J, Q, K):
16+
test("should return 10 for face cards", () => {
17+
const faceCard = getCardValue("J♥");
18+
expect(faceCard).toEqual(10);
19+
})
1620
// Case 4: Handle Ace (A):
21+
test("should return 11 for ace card", () => {
22+
const aceCard = getCardValue("A♥");
23+
expect (aceCard).toEqual(11);
24+
})
1725
// Case 5: Handle Invalid Cards:
1826
test("should return invalid card rank for random numbers", () => {
1927
const invalidRandomCard = getCardValue("85♠");

0 commit comments

Comments
 (0)