Skip to content

Commit c47b556

Browse files
solved-try-catch-test-issue
1 parent dfc3ad2 commit c47b556

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,23 @@ assertEquals(getCardValue("A♠"), 11);
4848
assertEquals(getCardValue("2♥"), 2);
4949
assertEquals(getCardValue("10♥"), 10);
5050
assertEquals(getCardValue("Q♦"), 10);
51-
assertEquals(getCardValue("♦Q"), "Invalid card");
52-
assertEquals(getCardValue("11♦"), "Invalid card");
53-
5451
// Handling invalid cards
5552
try {
5653
getCardValue("invalid");
5754

5855
// This line will not be reached if an error is thrown as expected
5956
console.error("Error was not thrown for invalid card");
6057
} catch (e) {}
58+
try {
59+
getCardValue("♦Q");
60+
61+
// This line will not be reached if an error is thrown as expected
62+
console.error("Error was not thrown for invalid card");
63+
} catch (e) {}
64+
try {
65+
getCardValue("11♦");
6166

67+
// This line will not be reached if an error is thrown as expected
68+
console.error("Error was not thrown for invalid card");
69+
} catch (e) {}
6270
// What other invalid card cases can you think of?

0 commit comments

Comments
 (0)