Skip to content

Commit 6a9a7cd

Browse files
committed
Enhance isProperFraction tests with detailed descriptions for clarity
1 parent cc9f8f2 commit 6a9a7cd

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,27 @@
22
// We will use the same function, but write tests for it using Jest in this file.
33
const isProperFraction = require("../implement/2-is-proper-fraction");
44

5-
test("should return true for a proper fraction", () => {
5+
test("should return true for a proper fraction (numerator < denominator)", () => {
66
expect(isProperFraction(2, 3)).toEqual(true);
77
});
88

99
// Case 2: Identify Improper Fractions:
10+
// When the numerator is greater than or equal to the denominator,
11+
// Then the function should return false
12+
test("should return false for an improper fraction (numerator > denominator)", () => {
13+
expect(isProperFraction(5, 2)).toEqual(false);
14+
});
1015

1116
// Case 3: Identify Negative Fractions:
17+
// When the numerator is negative but absolute value < denominator,
18+
// Then the function should return true
19+
test("should return true for a negative proper fraction (|numerator| < denominator)", () => {
20+
expect(isProperFraction(-4, 7)).toEqual(true);
21+
});
1222

1323
// Case 4: Identify Equal Numerator and Denominator:
24+
// When the numerator is equal to the denominator,
25+
// Then the function should return false
26+
test("should return false when numerator equals denominator", () => {
27+
expect(isProperFraction(3, 3)).toEqual(false);
28+
});

0 commit comments

Comments
 (0)