Skip to content

Commit 56625ec

Browse files
committed
3-get card value test with jest
1 parent 989855e commit 56625ec

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

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

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

1010
// Case 2: Handle Number Cards (2-10):
11+
test("should return numeric value for number cards (2-10)", () => {
12+
const fiveofHearts = getCardValue("5♥");
13+
expect(fiveofHearts).toEqual(5);
14+
});
1115
// Case 3: Handle Face Cards (J, Q, K):
16+
test("should return 10 for face cards (J, Q, K)", () => {
17+
const jackOfDiamonds = getCardValue("J♦");
18+
const queenOfClubs = getCardValue("Q♣");
19+
const kingOfHearts = getCardValue("K♥");
20+
expect(jackOfDiamonds).toEqual(10);
21+
expect(queenOfClubs).toEqual(10);
22+
expect(kingOfHearts).toEqual(10);
23+
});
24+
1225
// Case 4: Handle Ace (A):
26+
test("should return 11 for Ace (A)", () => {
27+
const aceOfSpades = getCardValue("A♠");
28+
expect(aceOfSpades).toEqual(11);
29+
});
30+
1331
// Case 5: Handle Invalid Cards:
32+
test("should return undefined for invalid cards", () => {
33+
const invalidCard = getCardValue("1♠");
34+
expect(invalidCard).toEqual(undefined);
35+
});

0 commit comments

Comments
 (0)