Skip to content

Commit e7b918f

Browse files
author
kohanman
committed
Sprint 3 | Jest Test Coursework 1.3
1 parent 05f0fb6 commit e7b918f

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

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

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,24 @@ test("should return 11 for Ace of Spades", () => {
77
expect(aceofSpades).toEqual(11);
88
});
99

10-
// Case 2: Handle Number Cards (2-10):
11-
// Case 3: Handle Face Cards (J, Q, K):
10+
test("should return 5 for 5 of Hearts", () => {
11+
const fiveofHearts = getCardValue("5♥");
12+
expect(fiveofHearts).toEqual(5);
13+
});
14+
15+
test("should return 10 for Face Cards", () => {
16+
const faceCards = getCardValue("10" || "J" || "Q" || "K");
17+
expect(faceCards).toEqual(10);
18+
});
19+
1220
// Case 4: Handle Ace (A):
21+
test("should return 11 for Aces", () => {
22+
const anyAce = getCardValue("A");
23+
expect(anyAce).toEqual(11);
24+
});
25+
1326
// Case 5: Handle Invalid Cards:
27+
test("should return 'Invalid card rank.' for invalid cards", () => {
28+
const invalidCard = getCardValue("z");
29+
expect(invalidCard).toEqual("Invalid card rank.");
30+
});

0 commit comments

Comments
 (0)