@@ -11,18 +11,23 @@ test(`Should return 11 when given an ace card`, () => {
1111} ) ;
1212
1313// Case 2
14- test ( `Should return 10 when given an jack, queen, king` , ( ) => {
14+ test ( `Should return 10 when given a jack, queen, king` , ( ) => {
1515 expect ( getCardValue ( "J♠" ) ) . toEqual ( 10 ) ;
1616 expect ( getCardValue ( "Q♥" ) ) . toEqual ( 10 ) ;
1717 expect ( getCardValue ( "K♠" ) ) . toEqual ( 10 ) ;
18- expect ( ( ) => getCardValue ( "K🤣" ) ) . toThrow ( Error ) ;
18+ expect ( ( ) => getCardValue ( "K🤣" ) ) . toThrow (
19+ "Invalid last character detected, only suits(♠♥♦♣) are allowed, but got this character:"
20+ ) ;
1921 expect ( ( ) => getCardValue ( "KKW🤣" ) ) . toThrow ( Error ) ;
2022} ) ;
2123
2224// Case 3
2325test ( `Should return number when given a number` , ( ) => {
2426 expect ( getCardValue ( "2♠" ) ) . toEqual ( 2 ) ;
2527 expect ( getCardValue ( "10♥" ) ) . toEqual ( 10 ) ;
28+ expect ( ( ) => getCardValue ( "0♠" ) ) . toThrow ( Error ) ;
29+ expect ( ( ) => getCardValue ( "1♠" ) ) . toThrow ( Error ) ;
30+ expect ( ( ) => getCardValue ( "10Q" ) ) . toThrow ( Error ) ;
2631 expect ( ( ) => getCardValue ( "423🤣" ) ) . toThrow ( Error ) ;
2732} ) ;
2833
@@ -31,6 +36,7 @@ test("Should return error on invalid input", () => {
3136 expect ( ( ) => getCardValue ( undefined ) ) . toThrow ( Error ) ;
3237 expect ( ( ) => getCardValue ( 12398 ) ) . toThrow ( Error ) ;
3338 expect ( ( ) => getCardValue ( NaN ) ) . toThrow ( Error ) ;
39+ expect ( ( ) => getCardValue ( "♠" ) ) . toThrow ( Error ) ;
3440} ) ;
3541
3642// Suggestion: Group the remaining test data into these categories:
0 commit comments