Skip to content

Commit 9d4539d

Browse files
committed
Implemented Jest test for tricky invalid cards
1 parent fc8717b commit 9d4539d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ test("Should return Invalid card", ()=>{
2828
expect(() => getCardValue("1X")).toThrow("Invalid card");
2929
expect(() => getCardValue("0♥")).toThrow("Invalid card");
3030
});
31+
// Invalid card format
32+
test("Should throw error for tricky invalid card formats", () => {
33+
expect(() => getCardValue("0x02♠")).toThrow("Invalid card");
34+
expect(() => getCardValue("QQ♠")).toThrow("Invalid card");
35+
expect(() => getCardValue("2.1♠")).toThrow("Invalid card");
36+
});
3137
// To learn how to test whether a function throws an error as expected in Jest,
3238
// please refer to the Jest documentation:
3339
// https://jestjs.io/docs/expect#tothrowerror

0 commit comments

Comments
 (0)