@@ -12,19 +12,15 @@ test(`Should return 11 when given an ace card`, () => {
1212 expect ( getCardValue ( "A♣" ) ) . toEqual ( 11 ) ;
1313} ) ;
1414
15-
16-
1715// Suggestion: Group the remaining test data into these categories:
1816// Number Cards (2-10)
1917// Face Cards (J, Q, K)
2018// Invalid Cards
2119
22-
2320// To learn how to test whether a function throws an error as expected in Jest,
2421// please refer to the Jest documentation:
2522// https://jestjs.io/docs/expect#tothrowerror
2623
27-
2824// Number cards
2925test ( `Should return the number when given a number card` , ( ) => {
3026 expect ( getCardValue ( "2♠" ) ) . toEqual ( 2 ) ;
@@ -33,22 +29,13 @@ test(`Should return the number when given a number card`, () => {
3329 expect ( getCardValue ( "6♣" ) ) . toEqual ( 6 ) ;
3430} ) ;
3531
36-
3732// Face Cards (J, Q, K)
3833test ( `Should return 10 when given a face card` , ( ) => {
3934 expect ( getCardValue ( "J♠" ) ) . toEqual ( 10 ) ;
4035 expect ( getCardValue ( "Q♥" ) ) . toEqual ( 10 ) ;
41- expect ( getCardValue ( "K♦" ) ) . toEqual ( 10 ) ;
36+ expect ( getCardValue ( "K♦" ) ) . toEqual ( 10 ) ;
4237} ) ;
4338
44-
45- // test(`Should throw an error when given an invalid card`, () => {
46- // expect(() => getCardValue("1♠")).toThrow();
47- // expect(() => getCardValue("Z♦")).toThrow();
48- // expect(() => getCardValue("11♥")).toThrow();
49- // expect(() => getCardValue("")).toThrow();
50- // });
51-
5239// Invalid Cards
5340test ( `Should throw an error when given an invalid card` , ( ) => {
5441 expect ( ( ) => getCardValue ( "1♣" ) ) . toThrow ( "Invalid Card" ) ;
@@ -58,4 +45,4 @@ test(`Should throw an error when given an invalid card`, () => {
5845 expect ( ( ) => getCardValue ( "" ) ) . toThrow ( "Invalid Card" ) ;
5946 expect ( ( ) => getCardValue ( "invalid" ) ) . toThrow ( "Invalid Card" ) ;
6047 expect ( ( ) => getCardValue ( "----" ) ) . toThrow ( "Invalid Card" ) ;
61- } ) ;
48+ } ) ;
0 commit comments