Skip to content

Commit 0359872

Browse files
committed
Enhance test descriptions for isProperFraction function for clarity and completeness
1 parent ed99cda commit 0359872

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

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

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,26 @@
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-
10+
test("should return false for an improper fraction (numerator > denominator)", () => {
11+
expect(isProperFraction(5, 3)).toEqual(false);
12+
});
1113
// Case 3: Identify Negative Fractions:
12-
14+
test("should return true for a negative proper fraction", () => {
15+
expect(isProperFraction(-1, 4)).toEqual(true);
16+
expect(isProperFraction(1, -4)).toEqual(true);
17+
expect(isProperFraction(-1, -4)).toEqual(true);
18+
});
19+
test("should return false for a negative improper fraction", () => {
20+
expect(isProperFraction(4, -3)).toEqual(false);
21+
expect(isProperFraction(5, -4)).toEqual(false);
22+
expect(isProperFraction(-5, 4)).toEqual(false);
23+
});
1324
// Case 4: Identify Equal Numerator and Denominator:
25+
test("should return false when numerator and denominator are equal", () => {
26+
expect(isProperFraction(5, 5)).toEqual(false);
27+
});

0 commit comments

Comments
 (0)