Skip to content

Commit 6cd7b35

Browse files
committed
rewrite: get card value test exercise done
1 parent 049c628 commit 6cd7b35

File tree

2 files changed

+3135
-0
lines changed

2 files changed

+3135
-0
lines changed

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

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

1010
// Case 2: Handle Number Cards (2-10):
11+
test("should return the number entered as input", () => {
12+
const numberCards = getCardValue("4♠");
13+
expect(numberCards).toEqual(4);
14+
});
15+
1116
// Case 3: Handle Face Cards (J, Q, K):
17+
test("should return 10 for face cards J Q K", () => {
18+
const faceCards = getCardValue("Q♠");
19+
expect(faceCards).toEqual(10);
20+
});
21+
1222
// Case 4: Handle Ace (A):
23+
test("should return 11 after entering Ace A", () => {
24+
const handleAce = getCardValue("A♠");
25+
expect(handleAce).toEqual(11);
26+
});
27+
1328
// Case 5: Handle Invalid Cards:
29+
test(`should return string ("Invalid card rank.") for invalid inputs`, () => {
30+
const invalidCards = getCardValue("HelloWorld!");
31+
expect(invalidCards).toEqual("Invalid card rank.");
32+
});

0 commit comments

Comments
 (0)