Skip to content

Commit dbdc848

Browse files
committed
updates for sprint 3 3-Get-card-valuse
1 parent 73464a7 commit dbdc848

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,19 @@ test(`Should return 11 when given an ace card`, () => {
1111

1212
// Suggestion: Group the remaining test data into these categories:
1313
// Number Cards (2-10)
14+
test(`Should return 2 when given a 2 card`, () => {
15+
expect(getCardValue("2♠")).toEqual(2);
16+
});
17+
test(`Should return 10 when given a 10 card`, () => {
18+
expect(getCardValue("10♠")).toEqual(10);
19+
});
1420
// Face Cards (J, Q, K)
1521
// Invalid Cards
16-
22+
test(`Should throw an error when given an invalid card`, () => {
23+
expect(() => getCardValue("11♠")).toThrow("Invalid card: Invalid rank");
24+
expect(() => getCardValue("A")).toThrow("Invalid card: Invalid suit");
25+
expect(() => getCardValue("2X")).toThrow("Invalid card: Invalid suit");
26+
}
1727
// To learn how to test whether a function throws an error as expected in Jest,
1828
// please refer to the Jest documentation:
1929
// https://jestjs.io/docs/expect#tothrowerror

0 commit comments

Comments
 (0)