@@ -8,52 +8,28 @@ test(`Should return 11 when given an ace card`, () => {
88} ) ;
99
1010// Case 2: Number Cards (2-10)
11- test ( `Should return 2 when given number 2 card` , ( ) => {
11+ test ( `Should return its numeric value when given a number card` , ( ) => {
1212 expect ( getCardValue ( "2♥" ) ) . toEqual ( 2 ) ;
13- } ) ;
14-
15- test ( `Should return 3 when given number 3 card` , ( ) => {
1613 expect ( getCardValue ( "3♣" ) ) . toEqual ( 3 ) ;
17- } ) ;
18-
19- test ( `Should return 4 when given number 4 card` , ( ) => {
2014 expect ( getCardValue ( "4♠" ) ) . toEqual ( 4 ) ;
21- } ) ;
22-
23- test ( `Should return 5 when given number 5 card` , ( ) => {
2415 expect ( getCardValue ( "5♦" ) ) . toEqual ( 5 ) ;
25- } ) ;
26-
27- test ( `Should return 6 when given number 6 card` , ( ) => {
2816 expect ( getCardValue ( "6♣" ) ) . toEqual ( 6 ) ;
29- } ) ;
30-
31- test ( `Should return 7 when given number 7 card` , ( ) => {
3217 expect ( getCardValue ( "7♠" ) ) . toEqual ( 7 ) ;
33- } ) ;
34-
35- test ( `Should return 8 when given number 8 card` , ( ) => {
3618 expect ( getCardValue ( "8♥" ) ) . toEqual ( 8 ) ;
37- } ) ;
38-
39- test ( `Should return 9 when given number 9 card` , ( ) => {
4019 expect ( getCardValue ( "9♣" ) ) . toEqual ( 9 ) ;
41- } ) ;
42-
43- test ( `Should return 10 when given number 10 card` , ( ) => {
4420 expect ( getCardValue ( "10♦" ) ) . toEqual ( 10 ) ;
4521} ) ;
4622
4723// Case 3: Face Cards (J, Q, K)
48- test ( `Should return 10 when given a Kings card` , ( ) => {
24+ test ( `Should return 10 when given a face card` , ( ) => {
4925 expect ( getCardValue ( "K♠" ) ) . toEqual ( 10 ) ;
26+ expect ( getCardValue ( "Q♠" ) ) . toEqual ( 10 ) ;
27+ expect ( getCardValue ( "K♦" ) ) . toEqual ( 10 ) ;
5028} ) ;
5129
52- test ( `Should return 10 when given a Queen card` , ( ) => {
53- expect ( getCardValue ( "Q♦" ) ) . toEqual ( 10 ) ;
54- } ) ;
30+ // Case 4: Invalid Cards
5531
56- test ( `Should return "Invalid" when given invalid cards card` , ( ) => {
32+ test ( `Should return "Invalid" when given an invalid card` , ( ) => {
5733 expect ( ( ) => getCardValue ( "" ) ) . toThrow ( ) ;
5834 expect ( ( ) => getCardValue ( "♠" ) ) . toThrow ( ) ;
5935 expect ( ( ) => getCardValue ( "A" ) ) . toThrow ( ) ;
@@ -65,8 +41,6 @@ test(`Should return "Invalid" when given invalid cards card`, () => {
6541 expect ( ( ) => getCardValue ( "5♠♥" ) ) . toThrow ( ) ;
6642} ) ;
6743
68- // Case 4: Invalid Cards
69-
7044// Suggestion: Group the remaining test data into these categories:
7145// Number Cards (2-10)
7246// Face Cards (J, Q, K)
@@ -75,4 +49,3 @@ test(`Should return "Invalid" when given invalid cards card`, () => {
7549// To learn how to test whether a function throws an error as expected in Jest,
7650// please refer to the Jest documentation:
7751// https://jestjs.io/docs/expect#tothrowerror
78-
0 commit comments