Skip to content

Commit c98b477

Browse files
committed
Completed 3-get-card-value.test.js exercise
1 parent 0631bd4 commit c98b477

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-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 5 for a number card", () => {
12+
const fiveofHearts = getCardValue("5♥");
13+
expect(fiveofHearts).toEqual(5);
14+
});
15+
1116
// Case 3: Handle Face Cards (J, Q, K):
17+
test("should return 10 for a face card", () => {
18+
const jackOfDiamonds = getCardValue("J♢");
19+
expect(jackOfDiamonds).toEqual(10);
20+
});
21+
1222
// Case 4: Handle Ace (A):
23+
test("should return 11 for an Ace", () => {
24+
const ace = getCardValue("A");
25+
expect(ace).toEqual(11);
26+
});
27+
1328
// Case 5: Handle Invalid Cards:
29+
test("should return `Invalid card rank.` for an invalid card", () => {
30+
const invalidRank = getCardValue("@");
31+
expect(invalidRank).toEqual("Invalid card rank.");
32+
});

0 commit comments

Comments
 (0)