Skip to content

Commit 3a4df3a

Browse files
committed
Cards Tests
1 parent ba395e1 commit 3a4df3a

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

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

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

1010
// Case 2: Handle Number Cards (2-10):
11+
12+
test("should return number cards", () => {
13+
const fiveofHearts = getCardValue("5♥");
14+
expect(fiveofHearts).toEqual(5);
15+
});
16+
1117
// Case 3: Handle Face Cards (J, Q, K):
18+
test ("should return Face Cards J, Q, K ", () =>{
19+
const jackOfClubs = getCardValue("J♣");
20+
expect(jackOfClubs).toEqual(10);
21+
});
22+
1223
// Case 4: Handle Ace (A):
24+
test ("should return Ace", () =>{
25+
const aceofHearts = getCardValue("A♥");
26+
expect(aceofHearts).toEqual(11);
27+
});
1328
// Case 5: Handle Invalid Cards:
29+
test("should throw 'Invalid card rank' for a rank of '1'", () => {
30+
expect(() => getCardValue("1♦")).toThrow("Invalid card rank.");
31+
});

0 commit comments

Comments
 (0)