Skip to content

Commit fafb4c4

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

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
@@ -68,6 +68,12 @@ test(`Should throw error when given '5'`, () => {
6868
}).toThrow(/Expected a number followed by a suit, but got "5"/);
6969
});
7070

71+
test(`Should throw error when given 'Q'`, () => {
72+
expect(() => {
73+
getCardValue("Q");
74+
}).toThrow(/Expected a number followed by a suit, but got "Q"/);
75+
});
76+
7177
// To learn how to test whether a function throws an error as expected in Jest,
7278
// please refer to the Jest documentation:
7379
// https://jestjs.io/docs/expect#tothrowerror

0 commit comments

Comments
 (0)