Skip to content

Commit 73464a7

Browse files
committed
updates for sprint 3 3-Get-card-valuse
1 parent 1a219a0 commit 73464a7

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@ function assertEquals(actualOutput, targetOutput) {
5858
// TODO: Write tests to cover all outcomes, including throwing errors for invalid cards.
5959
// Examples:
6060
assertEquals(getCardValue("9♠"), 9);
61+
assertEquals(getCardValue("A♥"), 11);
62+
assertEquals(getCardValue("J♦"), 10);
63+
assertEquals(getCardValue("Q♣"), 10);
64+
assertEquals(getCardValue("K♦"), 10);
65+
assertEquals(getCardValue("10♥"), 10);
66+
assertEquals(getCardValue("11♠"), "invalid"); // This should throw an error
67+
assertEquals(getCardValue("A"), "invalid"); // This should throw an error
68+
assertEquals(getCardValue("2X"), "invalid"); // This should throw an error
69+
70+
6171

6272
// Handling invalid cards
6373
try {
@@ -68,3 +78,8 @@ try {
6878
} catch (e) {}
6979

7080
// What other invalid card cases can you think of?
81+
assertEquals(getCardValue(""), "invalid"); // This should throw an error
82+
assertEquals(getCardValue("A♠♠"), "invalid"); // This should throw an error
83+
assertEquals(getCardValue("1♠"), "invalid"); // This should throw an error
84+
assertEquals(getCardValue("B♠"), "invalid"); // This should throw an error
85+
assertEquals(getCardValue("A♠A"), "invalid"); // This should throw an error

0 commit comments

Comments
 (0)