Skip to content

Commit d6ce110

Browse files
committed
Completed 3-get-card-value.test.js
1 parent 2fdc1ca commit d6ce110

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

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

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,27 @@ test(`Should return 11 when given an ace card`, () => {
1414
// Face Cards (J, Q, K)
1515
// Invalid Cards
1616

17+
// Case 2: Number Cards (2-10)
18+
test(`Should return the correct value for number cards`, () => {
19+
expect(getCardValue("2♣")).toEqual(2);
20+
expect(getCardValue("5♦")).toEqual(5);
21+
expect(getCardValue("10♥")).toEqual(10);
22+
});
23+
24+
// Case 3: Face Cards (J, Q, K)
25+
test(`Should return 10 for face cards`, () => {
26+
expect(getCardValue("J♠")).toEqual(10);
27+
expect(getCardValue("Q♦")).toEqual(10);
28+
expect(getCardValue("K♥")).toEqual(10);
29+
});
30+
31+
// Case 4: Invalid Cards
32+
test(`Should return Invalid card rank for invalid cards`, () => {
33+
expect(getCardValue("1♠")).toEqual("Invalid card rank");
34+
expect(getCardValue("11♥")).toEqual("Invalid card rank");
35+
expect(getCardValue("Z♦")).toEqual("Invalid card rank");
36+
});
37+
1738
// To learn how to test whether a function throws an error as expected in Jest,
1839
// please refer to the Jest documentation:
1940
// https://jestjs.io/docs/expect#tothrowerror
20-

0 commit comments

Comments
 (0)