Skip to content

Commit 53d733c

Browse files
committed
Add test cases for single-digit card
1 parent 651191c commit 53d733c

1 file changed

Lines changed: 27 additions & 1 deletion

File tree

‎implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js‎

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,33 @@ import { getCardValue } from "../implement/3-get-card-value.js";
88
test("Valid single-digit card", () => {
99
assert.equal(getCardValue("9♠"), 9);
1010
});
11+
test("Valid single-digit card", () => {
12+
assert.equal(getCardValue("8♥"), 8);
13+
});
14+
test("Valid single-digit card", () => {
15+
assert.equal(getCardValue("7♣"), 7);
16+
});
17+
test("Valid single-digit card", () => {
18+
assert.equal(getCardValue("6♦"), 6);
19+
});
20+
test("Valid single-digit card", () => {
21+
assert.equal(getCardValue("5♥"), 5);
22+
});
23+
test("Valid single-digit card", () => {
24+
assert.equal(getCardValue("4♦"), 4);
25+
});
26+
test("Valid single-digit card", () => {
27+
assert.equal(getCardValue("3♠"), 3);
28+
});
29+
test("Valid single-digit card", () => {
30+
assert.equal(getCardValue("2♣"), 2);
31+
});
32+
1133
test("Arbitrary non-card string", () => {
12-
assert.throws(() => getCardValue("invalid"), /Expected a number followed by a suit, but got "invalid"/, "Expected clear error");
34+
assert.throws(
35+
() => getCardValue("invalid"),
36+
/Expected a number followed by a suit, but got "invalid"/,
37+
"Expected clear error"
38+
);
1339
});
1440
// TODO: What other invalid card cases can you think of?

0 commit comments

Comments
 (0)