Skip to content

Commit 1b1293e

Browse files
committed
fixed throw error issue in card value test file
1 parent 267e816 commit 1b1293e

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

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

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,31 @@ test(`Should return 10 when given a face card`, () => {
2424
});
2525

2626
// Case 4: Invalid Cards
27-
test(`Should return Invalid Card when given an invalid card`, () => {
28-
expect(getCardValue("Aas♠")).toEqual("Invalid card");
29-
expect(getCardValue("What")).toEqual("Invalid card");
30-
expect(getCardValue("Q10")).toEqual("Invalid card");
31-
expect(getCardValue("11")).toEqual("Invalid card");
32-
expect(getCardValue("♠11")).toEqual("Invalid card");
33-
expect(getCardValue("10*")).toEqual("Invalid card");
34-
expect(getCardValue("Q_")).toEqual("Invalid card");
35-
expect(getCardValue("A10")).toEqual("Invalid card");
27+
test(`Should return Error when given an invalid card`, () => {
28+
expect(() => {
29+
getCardValue("Aas♠");
30+
}).toThrow();
31+
expect(() => {
32+
getCardValue("What");
33+
}).toThrow();
34+
expect(() => {
35+
getCardValue("Q10");
36+
}).toThrow();
37+
expect(() => {
38+
getCardValue("11");
39+
}).toThrow();
40+
expect(() => {
41+
getCardValue("♠11");
42+
}).toThrow();
43+
expect(() => {
44+
getCardValue("10*");
45+
}).toThrow();
46+
expect(() => {
47+
getCardValue("Q_");
48+
}).toThrow();
49+
expect(() => {
50+
getCardValue("A10");
51+
}).toThrow();
3652
});
3753

3854
// Suggestion: Group the remaining test data into these categories:

0 commit comments

Comments
 (0)