Skip to content

Commit 5237b54

Browse files
I catagrised the error messages and made them consistent
1 parent 34ae0f2 commit 5237b54

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

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

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,11 @@ test(`Should return 10 when given a face card (J, Q, K)`, () => {
2222
expect(getCardValue("Q♠")).toEqual(10);
2323
expect(getCardValue("K♠")).toEqual(10);
2424
})
25-
// Invalid Card suits
26-
test(`Should throw an error when given an invalid card suit`, () => {
27-
expect(() => getCardValue("3-")).toThrow("Invalid card rank");
28-
expect(() => getCardValue("5X")).toThrow("Invalid card suit")});
29-
30-
// Invalid Card ranks
31-
test(`Should throw an error when given an invalid card rank`, () => {
32-
expect(() => getCardValue("1♠")).toThrow("Invalid card rank");
33-
expect(() => getCardValue("11♠")).toThrow("Invalid card rank");
25+
// Invalid Cards
26+
test(`Should throw an error when given an invalid card`, () => {
27+
expect(() => getCardValue("5X")).toThrow("Invalid card ")}); //invalid suit
28+
expect(() => getCardValue("1♠")).toThrow("Invalid card "); //invalid rank
29+
expect(() => getCardValue("3")).toThrow("Invalid card "); //missing suit
3430
})
3531

3632
// To learn how to test whether a function throws an error as expected in Jest,

0 commit comments

Comments
 (0)