@@ -20,72 +20,34 @@ test(`Should return 11 when given an ace card`, () => {
2020
2121// Suggestion: Group the remaining test data into these categories:
2222// Number Cards (2-10)
23- test ( `Should return 2 when given a 2 card` , ( ) => {
23+ test ( "should return the value of number cards (2-10)" , ( ) => {
2424 expect ( getCardValue ( "2♠" ) ) . toEqual ( 2 ) ;
25- } ) ;
26- test ( `Should return 3 when given a 3 card` , ( ) => {
2725 expect ( getCardValue ( "3♥" ) ) . toEqual ( 3 ) ;
28- } ) ;
29- test ( `Should return 4 when given a 4 card` , ( ) => {
3026 expect ( getCardValue ( "4♦" ) ) . toEqual ( 4 ) ;
31- } ) ;
32- test ( `Should return 5 when given a 5 card` , ( ) => {
3327 expect ( getCardValue ( "5♣" ) ) . toEqual ( 5 ) ;
34- } ) ;
35- test ( `Should return 6 when given a 6 card` , ( ) => {
3628 expect ( getCardValue ( "6♥" ) ) . toEqual ( 6 ) ;
37- } ) ;
38- test ( `Should return 7 when given a 7 card` , ( ) => {
3929 expect ( getCardValue ( "7♠" ) ) . toEqual ( 7 ) ;
40- } ) ;
41- test ( `Should return 8 when given a 8 card` , ( ) => {
4230 expect ( getCardValue ( "8♦" ) ) . toEqual ( 8 ) ;
43- } ) ;
44- test ( `Should return 9 when given a 9 card` , ( ) => {
4531 expect ( getCardValue ( "9♠" ) ) . toEqual ( 9 ) ;
46- } ) ;
47- test ( `Should return 10 when given a 10 card` , ( ) => {
4832 expect ( getCardValue ( "10♣" ) ) . toEqual ( 10 ) ;
4933} ) ;
5034
5135// Face Cards (J, Q, K)
52- test ( `Should return 10 when given a J card ` , ( ) => {
36+ test ( `Should return the value of face cards (J, Q, K) ` , ( ) => {
5337 expect ( getCardValue ( "J♠" ) ) . toEqual ( 10 ) ;
54- } ) ;
55- test ( `Should return 10 when given a Q card` , ( ) => {
5638 expect ( getCardValue ( "Q♦" ) ) . toEqual ( 10 ) ;
57- } ) ;
58- test ( `Should return 10 when given a K card` , ( ) => {
5939 expect ( getCardValue ( "K♥" ) ) . toEqual ( 10 ) ;
6040} ) ;
6141// Invalid Cards
6242test ( `Should throw an error when given an invalid card` , ( ) => {
6343 expect ( ( ) => getCardValue ( "1♠" ) ) . toThrow ( ) ;
64- } ) ;
65- test ( `Should throw an error when given an invalid card` , ( ) => {
6644 expect ( ( ) => getCardValue ( "2❦" ) ) . toThrow ( ) ;
67- } ) ;
68-
69- test ( `Should throw an error when given an invalid card` , ( ) => {
7045 expect ( ( ) => getCardValue ( "11♥" ) ) . toThrow ( ) ;
71- } ) ;
72- test ( `Should throw an error when given an invalid card` , ( ) => {
7346 expect ( ( ) => getCardValue ( "B♦" ) ) . toThrow ( ) ;
74- } ) ;
75- test ( `Should throw an error when given an invalid card` , ( ) => {
7647 expect ( ( ) => getCardValue ( "Z♣" ) ) . toThrow ( ) ;
77- } ) ;
78- test ( `Should throw an error when given an invalid card` , ( ) => {
7948 expect ( ( ) => getCardValue ( "♣2" ) ) . toThrow ( ) ;
80- } ) ;
81- test ( `Should throw an error when given an invalid card` , ( ) => {
8249 expect ( ( ) => getCardValue ( "s" ) ) . toThrow ( ) ;
83- } ) ;
84- test ( `Should throw an error when given an invalid card` , ( ) => {
8550 expect ( ( ) => getCardValue ( "♣♥♠♦" ) ) . toThrow ( ) ;
86- } ) ;
87-
88- test ( `Should throw an error when given an invalid card` , ( ) => {
8951 expect ( ( ) => getCardValue ( "" ) ) . toThrow ( ) ;
9052} ) ;
9153
0 commit comments