Skip to content

Commit 43d650c

Browse files
committed
added jest tests for different card values
1 parent 6865348 commit 43d650c

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,16 @@ test("should return true for a proper fraction", () => {
77
});
88

99
// Case 2: Identify Improper Fractions:
10+
test("should return false for an improper fraction", () => {
11+
expect(isProperFraction(7, 4)).toEqual(false);
12+
});
1013

1114
// Case 3: Identify Negative Fractions:
15+
test("should return true for a proper fraction based on the absolute values of the numerator and denominator", () => {
16+
expect(isProperFraction(-3, 8)).toEqual(true);
17+
});
1218

1319
// Case 4: Identify Equal Numerator and Denominator:
20+
test("should return false for an equal fraction", () => {
21+
expect(isProperFraction(4, 4)).toEqual(false);
22+
});

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,22 @@ test("should return 11 for Ace of Spades", () => {
88
});
99

1010
// Case 2: Handle Number Cards (2-10):
11+
test("should return a number matchig the rank value for given card", () => {
12+
const numberCard = getCardValue("5♠");
13+
expect(numberCard).toEqual(5);
14+
});
1115
// Case 3: Handle Face Cards (J, Q, K):
16+
test("should return 10 for Face Cards", () => {
17+
const faceCard = getCardValue("K♠");
18+
expect(faceCard).toEqual(10);
19+
});
1220
// Case 4: Handle Ace (A):
21+
test("should return 11 for Ace", () => {
22+
const aceCard = getCardValue("A◆");
23+
expect(aceCard).toEqual(11);
24+
});
1325
// Case 5: Handle Invalid Cards:
26+
test("should return 11 for Ace of Spades", () => {
27+
const invalidCard = getCardValue("1♥");
28+
expect(invalidCard).toEqual("Invalid card rank.");
29+
});

0 commit comments

Comments
 (0)