Skip to content

Commit e5b18e4

Browse files
committed
added more tests to make the test suites more robust, moved ten to number cards test suite.
1 parent 137fd7c commit e5b18e4

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

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

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,18 @@
33
const getCardValue = require("../implement/3-get-card-value");
44

55
// Case 2: Handle Number Cards (2-10):
6-
test("should return a number matchig the rank value for number cards", () => {
7-
const numberCard = getCardValue("5♠");
8-
expect(numberCard).toEqual(5);
6+
test("should return a number matching the rank value for number cards", () => {
7+
expect(getCardValue("2♠")).toEqual(2);
8+
expect(getCardValue("3◆")).toEqual(3);
9+
expect(getCardValue("10♥")).toEqual(10);
10+
expect(getCardValue("9♠")).toEqual(9);
11+
expect(getCardValue("7♥")).toEqual(7);
912
});
1013
// Case 3: Handle Face Cards (J, Q, K):
1114
test("should return 10 for Face Cards", () => {
12-
const faceCard = getCardValue("10♠");
13-
expect(faceCard).toEqual(10);
15+
expect(getCardValue("J♠")).toEqual(10);
16+
expect(getCardValue("Q◆")).toEqual(10);
17+
expect(getCardValue("K♥")).toEqual(10);
1418
});
1519
// Case 4: Handle Ace (A):
1620
test("should return 11 for Ace", () => {
@@ -19,11 +23,9 @@ test("should return 11 for Ace", () => {
1923
});
2024
// Case 5: Handle Invalid Cards:
2125
test("should return invalid card rank for cards that are not in the suite", () => {
22-
const invalidCard = getCardValue("100♥");
23-
expect(invalidCard).toEqual("Invalid card rank.");
24-
});
25-
26-
test("should return invalid card rank for cards that are not in the suite", () => {
27-
const invalidCard = getCardValue("3.1416♥");
28-
expect(invalidCard).toEqual("Invalid card rank.");
26+
expect(getCardValue("100♠")).toEqual("Invalid card rank.");
27+
expect(getCardValue("3.1416◆")).toEqual("Invalid card rank.");
28+
expect(getCardValue("10.9♥")).toEqual("Invalid card rank.");
29+
expect(getCardValue("09♠")).toEqual("Invalid card rank.");
30+
expect(getCardValue("7+♥")).toEqual("Invalid card rank.");
2931
});

0 commit comments

Comments
 (0)