Skip to content

Commit f20ecce

Browse files
committed
Remove the looping over all number cards
1 parent 5040692 commit f20ecce

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

Sprint-3/2-mandatory-rewrite/3-get-card-value.test.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,11 @@ test("should return 11 for Ace", () => {
66
expect(getCardValue("A♥")).toEqual(11);
77
});
88

9-
// Case 2: Number cards (2–10)
10-
test("should return the value of number cards (210)", () => {
9+
// Case 2: Number cards (sample of 2–10)
10+
test("should return the value of number cards (2, 5, 10)", () => {
1111
expect(getCardValue("2♣")).toEqual(2);
1212
expect(getCardValue("5♠")).toEqual(5);
1313
expect(getCardValue("10♥")).toEqual(10);
14-
15-
// You can even loop for efficiency:
16-
for (let i = 2; i <= 10; i++) {
17-
expect(getCardValue(`${i}♦`)).toEqual(i);
18-
}
1914
});
2015

2116
// Case 3: Face cards (J, Q, K)
@@ -34,3 +29,4 @@ test("should throw an error for invalid card rank", () => {
3429
expect(() => getCardValue("0002♠")).toThrow("Invalid card rank");
3530
});
3631

32+

0 commit comments

Comments
 (0)