Skip to content

Commit 57c5bab

Browse files
committed
Add tests for all invalid card cases invalid suit, missing suit, empty string
1 parent d3eb33d commit 57c5bab

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ test("should return 10 for face cards", () => {
2323
expect(getCardValue("Q♥")).toEqual(10);
2424
expect(getCardValue("K♠")).toEqual(10);
2525
});
26-
test("should throw an error for invalid card", () => {
26+
test("should throw an error for invalid cards", () => {
2727
expect(() => getCardValue("1♣")).toThrow("invalid card rank.");
28+
expect(() => getCardValue("AX")).toThrow();
29+
expect(() => getCardValue("K")).toThrow();
30+
expect(() => getCardValue("")).toThrow();
2831
});
29-
3032
// To learn how to test whether a function throws an error as expected in Jest,
3133
// please refer to the Jest documentation:
3234
// https://jestjs.io/docs/expect#tothrowerror

0 commit comments

Comments
 (0)