Skip to content

Commit ead0e96

Browse files
committed
Add jest test for invalid card '5', throws error, test passes
1 parent 1f7930b commit ead0e96

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎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
@@ -62,6 +62,12 @@ test(`Should throw error when given '-3♦'`, () => {
6262
}).toThrow(/Expected a number followed by a suit, but got "-3♦"/);
6363
});
6464

65+
test(`Should throw error when given '5'`, () => {
66+
expect(() => {
67+
getCardValue("5");
68+
}).toThrow(/Expected a number followed by a suit, but got "5"/);
69+
});
70+
6571
// To learn how to test whether a function throws an error as expected in Jest,
6672
// please refer to the Jest documentation:
6773
// https://jestjs.io/docs/expect#tothrowerror

0 commit comments

Comments
 (0)