Skip to content

Commit d24a40f

Browse files
committed
get-card-value.test.js completed
1 parent 6a29885 commit d24a40f

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,26 @@ test(`Should return 11 when given an ace card`, () => {
1818
// please refer to the Jest documentation:
1919
// https://jestjs.io/docs/expect#tothrowerror
2020

21+
// Number Cards (2-10)
22+
test(`should return the number (numeric value)`, () => {
23+
expect(getCardValue("2♠")).toEqual(2);
24+
expect(getCardValue("10♥")).toEqual(10);
25+
expect(getCardValue("9♦")).toEqual(9);
26+
expect(getCardValue("4♣")).toEqual(4);
27+
expect(getCardValue("5♦")).toEqual(5);
28+
})
29+
30+
// Face Cards (J, Q, K)
31+
test(`should return 10 for face cards ("J", "Q", "K")`, () => {
32+
expect(getCardValue("J♠")).toEqual(10);
33+
expect(getCardValue("Q♣")).toEqual(10);
34+
expect(getCardValue("K♥")).toEqual(10);
35+
})
36+
37+
// Invalid Cards
38+
test(`should throw for invalid cards`, () => {
39+
expect(() => getCardValue("1♠")).toThrow();
40+
expect(() => getCardValue("11")).toThrow();
41+
expect(() => getCardValue("♣10")).toThrow();
42+
expect(() => getCardValue("♣")).toThrow();
43+
})

0 commit comments

Comments
 (0)