33const getCardValue = require ( "../implement/3-get-card-value" ) ;
44
55// Case 2: Handle Number Cards (2-10):
6- test ( "should return a number matchig the rank value for number cards" , ( ) => {
7- const numberCard = getCardValue ( "5♠" ) ;
8- expect ( numberCard ) . toEqual ( 5 ) ;
6+ test ( "should return a number matching the rank value for number cards" , ( ) => {
7+ expect ( getCardValue ( "2♠" ) ) . toEqual ( 2 ) ;
8+ expect ( getCardValue ( "3◆" ) ) . toEqual ( 3 ) ;
9+ expect ( getCardValue ( "10♥" ) ) . toEqual ( 10 ) ;
10+ expect ( getCardValue ( "9♠" ) ) . toEqual ( 9 ) ;
11+ expect ( getCardValue ( "7♥" ) ) . toEqual ( 7 ) ;
912} ) ;
1013// Case 3: Handle Face Cards (J, Q, K):
1114test ( "should return 10 for Face Cards" , ( ) => {
12- const faceCard = getCardValue ( "10♠" ) ;
13- expect ( faceCard ) . toEqual ( 10 ) ;
15+ expect ( getCardValue ( "J♠" ) ) . toEqual ( 10 ) ;
16+ expect ( getCardValue ( "Q◆" ) ) . toEqual ( 10 ) ;
17+ expect ( getCardValue ( "K♥" ) ) . toEqual ( 10 ) ;
1418} ) ;
1519// Case 4: Handle Ace (A):
1620test ( "should return 11 for Ace" , ( ) => {
@@ -19,11 +23,9 @@ test("should return 11 for Ace", () => {
1923} ) ;
2024// Case 5: Handle Invalid Cards:
2125test ( "should return invalid card rank for cards that are not in the suite" , ( ) => {
22- const invalidCard = getCardValue ( "100♥" ) ;
23- expect ( invalidCard ) . toEqual ( "Invalid card rank." ) ;
24- } ) ;
25-
26- test ( "should return invalid card rank for cards that are not in the suite" , ( ) => {
27- const invalidCard = getCardValue ( "3.1416♥" ) ;
28- expect ( invalidCard ) . toEqual ( "Invalid card rank." ) ;
26+ expect ( getCardValue ( "100♠" ) ) . toEqual ( "Invalid card rank." ) ;
27+ expect ( getCardValue ( "3.1416◆" ) ) . toEqual ( "Invalid card rank." ) ;
28+ expect ( getCardValue ( "10.9♥" ) ) . toEqual ( "Invalid card rank." ) ;
29+ expect ( getCardValue ( "09♠" ) ) . toEqual ( "Invalid card rank." ) ;
30+ expect ( getCardValue ( "7+♥" ) ) . toEqual ( "Invalid card rank." ) ;
2931} ) ;
0 commit comments