Skip to content

Commit 0e834a6

Browse files
committed
Add more tests
1 parent 8f61c0f commit 0e834a6

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,34 @@ test("should return undefined for invalid cards", () => {
3333
const invalidCard = getCardValue("1♠");
3434
expect(invalidCard).toEqual(undefined);
3535
});
36+
37+
test("should return correct value for all number cards 2-10", () => {
38+
expect(getCardValue("2♥")).toEqual(2);
39+
expect(getCardValue("3♣")).toEqual(3);
40+
expect(getCardValue("4♦")).toEqual(4);
41+
expect(getCardValue("5♠")).toEqual(5);
42+
expect(getCardValue("6♥")).toEqual(6);
43+
expect(getCardValue("7♣")).toEqual(7);
44+
expect(getCardValue("8♦")).toEqual(8);
45+
expect(getCardValue("9♠")).toEqual(9);
46+
expect(getCardValue("10♥")).toEqual(10);
47+
});
48+
49+
test("should handle numeric-literal edge cases", () => {
50+
expect(getCardValue("0x02♠")).toEqual(2);
51+
expect(getCardValue("2.1♠")).toBeUndefined();
52+
expect(getCardValue("0002♠")).toEqual(2);
53+
});
54+
55+
test("should return 10 for all face cards", () => {
56+
expect(getCardValue("J♠")).toEqual(10);
57+
expect(getCardValue("Q♥")).toEqual(10);
58+
expect(getCardValue("K♣")).toEqual(10);
59+
});
60+
61+
test("should return 11 for all Aces", () => {
62+
expect(getCardValue("A♠")).toEqual(11);
63+
expect(getCardValue("A♥")).toEqual(11);
64+
expect(getCardValue("A♦")).toEqual(11);
65+
expect(getCardValue("A♣")).toEqual(11);
66+
});

0 commit comments

Comments
 (0)