Skip to content

Commit 699f8c0

Browse files
committed
Add test cases for invalid card
1 parent 53d733c commit 699f8c0

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,15 @@ test("Arbitrary non-card string", () => {
3838
);
3939
});
4040
// TODO: What other invalid card cases can you think of?
41+
42+
test("Invalid cards", () => {
43+
assert.throws(() => getCardValue(""), "invalid");
44+
assert.throws(() => getCardValue("♠"), "invalid");
45+
assert.throws(() => getCardValue("A"), "invalid");
46+
assert.throws(() => getCardValue("5"), "invalid");
47+
assert.throws(() => getCardValue("1♠"), "invalid");
48+
assert.throws(() => getCardValue("0♠"), "invalid");
49+
assert.throws(() => getCardValue("11♠"), "invalid");
50+
assert.throws(() => getCardValue("X♠"), "invalid");
51+
assert.throws(() => getCardValue("5♠♥"), "invalid");
52+
});

0 commit comments

Comments
 (0)