Skip to content

Commit b0fe9de

Browse files
committed
test(sprint-3): add Jest tests for isProperFraction function
1 parent ec67b3b commit b0fe9de

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed
Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
1-
// This statement loads the isProperFraction function you wrote in the implement directory.
2-
// We will use the same function, but write tests for it using Jest in this file.
31
const isProperFraction = require("../implement/2-is-proper-fraction");
42

53
test("should return true for a proper fraction", () => {
64
expect(isProperFraction(2, 3)).toEqual(true);
75
});
86

9-
// Case 2: Identify Improper Fractions:
7+
test("should return false for an improper fraction (numerator >= denominator)", () => {
8+
expect(isProperFraction(5, 2)).toEqual(false);
9+
expect(isProperFraction(10, 3)).toEqual(false);
10+
expect(isProperFraction(7, 7)).toEqual(false);
11+
});
1012

11-
// Case 3: Identify Negative Fractions:
13+
test("should return true for a negative proper fraction (|numerator| < denominator)", () => {
14+
expect(isProperFraction(-4, 7)).toEqual(true);
15+
expect(isProperFraction(-2, 5)).toEqual(true);
16+
expect(isProperFraction(-1, 10)).toEqual(true);
17+
});
1218

13-
// Case 4: Identify Equal Numerator and Denominator:
19+
test("should return false when numerator equals denominator", () => {
20+
expect(isProperFraction(3, 3)).toEqual(false);
21+
expect(isProperFraction(1, 1)).toEqual(false);
22+
expect(isProperFraction(100, 100)).toEqual(false);
23+
});

0 commit comments

Comments
 (0)