Skip to content

Commit 2a0af31

Browse files
Implement test for strings in the Invalid cards
1 parent c8cef50 commit 2a0af31

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,21 @@ test("Should return the numeric value for number cards", () => {
1616
expect(getCardValue("10♦")).toEqual(10);
1717
});
1818

19-
2019
// Face Cards (J, Q, K)
2120
test("Should return 10 for face cards (J, Q, K)", () => {
2221
expect(getCardValue("J♠")).toEqual(10);
2322
expect(getCardValue("Q♠")).toEqual(10);
2423
expect(getCardValue("K♠")).toEqual(10);
2524
});
2625

27-
2826
// Invalid Cards
2927
test("Should throw an error for invalid cards", () => {
3028
expect(() => getCardValue(null)).toThrow();
3129
expect(() => getCardValue(undefined)).toThrow();
32-
})
30+
expect(() => getCardValue("11")).toThrow();
31+
expect(() => getCardValue("happy")).toThrow();
32+
});
3333

3434
// To learn how to test whether a function throws an error as expected in Jest,
3535
// please refer to the Jest documentation:
3636
// https://jestjs.io/docs/expect#tothrowerror
37-

0 commit comments

Comments
 (0)