Skip to content

Commit 2765c49

Browse files
committed
added tests for multiple samples, removed a test for ace of spades, corrected test description for invalid cards, used more informative descriptions
1 parent c56bd67 commit 2765c49

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,19 @@ test("should return true for a proper fraction", () => {
99
// Case 2: Identify Improper Fractions:
1010
test("should return false for an improper fraction", () => {
1111
expect(isProperFraction(7, 4)).toEqual(false);
12+
expect(isProperFraction(35, 8)).toEqual(false);
1213
});
1314

1415
// Case 3: Identify Negative Fractions:
1516
test("should return true for a proper fraction based on the absolute values of the numerator and denominator", () => {
1617
expect(isProperFraction(-3, 8)).toEqual(true);
18+
expect(isProperFraction(-3, -8)).toEqual(true);
19+
expect(isProperFraction(3, -8)).toEqual(true);
20+
expect(isProperFraction(3, 8)).toEqual(true);
1721
});
1822

1923
// Case 4: Identify Equal Numerator and Denominator:
2024
test("should return false for an equal fraction", () => {
2125
expect(isProperFraction(4, 4)).toEqual(false);
26+
expect(isProperFraction(-7, -7)).toEqual(false);
2227
});

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,14 @@
22
// We will use the same function, but write tests for it using Jest in this file.
33
const getCardValue = require("../implement/3-get-card-value");
44

5-
test("should return 11 for Ace of Spades", () => {
6-
const aceofSpades = getCardValue("A♠");
7-
expect(aceofSpades).toEqual(11);
8-
});
9-
105
// Case 2: Handle Number Cards (2-10):
11-
test("should return a number matchig the rank value for given card", () => {
6+
test("should return a number matchig the rank value for number cards", () => {
127
const numberCard = getCardValue("5♠");
138
expect(numberCard).toEqual(5);
149
});
1510
// Case 3: Handle Face Cards (J, Q, K):
1611
test("should return 10 for Face Cards", () => {
17-
const faceCard = getCardValue("K♠");
12+
const faceCard = getCardValue("10♠");
1813
expect(faceCard).toEqual(10);
1914
});
2015
// Case 4: Handle Ace (A):
@@ -23,7 +18,12 @@ test("should return 11 for Ace", () => {
2318
expect(aceCard).toEqual(11);
2419
});
2520
// Case 5: Handle Invalid Cards:
26-
test("should return 11 for Ace of Spades", () => {
27-
const invalidCard = getCardValue("1♥");
21+
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♥");
2828
expect(invalidCard).toEqual("Invalid card rank.");
2929
});

0 commit comments

Comments
 (0)