Skip to content

Commit 7139e24

Browse files
committed
Generalise test case3
1 parent 283fe06 commit 7139e24

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

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

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,12 @@ test("should return 5 for Five of Hearts", () => {
1313
expect(fiveofHearts).toEqual(5);
1414
});
1515
// Case 3: Handle Face Cards (J, Q, K):
16-
test("should return 10 for Jack of Diamonds", () => {
17-
const jackofDiamonds = getCardValue("J♦");
18-
expect(jackofDiamonds).toEqual(10);
19-
});
20-
test("should return 10 for Queen of Clubs", () => {
21-
const queenofClubs = getCardValue("Q♣");
22-
expect(queenofClubs).toEqual(10);
23-
});
24-
test("should return 10 for King of Hearts", () => {
25-
const kingofHearts = getCardValue("K♥");
26-
expect(kingofHearts).toEqual(10);
16+
test("should return 10 for all face cards (J, Q, K)", () => {
17+
const faceCards = ["J♦", "Q♣", "K♥"];
18+
faceCards.forEach((card) => {
19+
const value = getCardValue(card);
20+
expect(value).toEqual(10);
21+
});
2722
});
2823
// Case 4: Handle Ace (A):
2924
test("should return 11 for Ace of Spades", () => {

0 commit comments

Comments
 (0)