File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed
Sprint-3/2-mandatory-rewrite Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change 11const getCardValue = require ( "./3-get-card-value" ) ;
22
33test ( "should return 11 for Ace of Spades" , ( ) => {
4- const aceofSpades = getCardValue ( "A♠" ) ;
5- expect ( aceofSpades ) . toEqual ( 11 ) ;
6- } ) ;
4+ const aceofSpades = getCardValue ( "A♠" ) ;
5+ expect ( aceofSpades ) . toEqual ( 11 ) ;
6+ } ) ;
77
88// Case 2: Handle Number Cards (2-10):
9+ test ( "should return 7 for 7 of Hearts" , ( ) => {
10+ const sevenOfHearts = getCardValue ( "7♥" ) ;
11+ expect ( sevenOfHearts ) . toEqual ( 7 ) ;
12+ } ) ;
913// Case 3: Handle Face Cards (J, Q, K):
14+ test ( "should return 10 for King of Diamonds" , ( ) => {
15+ const kingOfDiamonds = getCardValue ( "K♦" ) ;
16+ expect ( kingOfDiamonds ) . toEqual ( 10 ) ;
17+ } ) ;
1018// Case 4: Handle Ace (A):
19+ test ( "should return 11 for Ace of Clubs" , ( ) => {
20+ const aceOfClubs = getCardValue ( "A♣" ) ;
21+ expect ( aceOfClubs ) . toEqual ( 11 ) ;
22+ } ) ;
1123// Case 5: Handle Invalid Cards:
24+ test ( "should return 0 for invalid card 'X♠'" , ( ) => {
25+ const invalidCard = getCardValue ( "X♠" ) ;
26+ expect ( invalidCard ) . toEqual ( 0 ) ;
27+ } ) ;
You can’t perform that action at this time.
0 commit comments