-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2-is-proper-fraction.test.js
More file actions
27 lines (21 loc) · 1.02 KB
/
Copy path2-is-proper-fraction.test.js
File metadata and controls
27 lines (21 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// This statement loads the isProperFraction function you wrote in the implement directory.
// We will use the same function, but write tests for it using Jest in this file.
const isProperFraction = require("../implement/2-is-proper-fraction");
test("should return true for a proper fraction", () => {
expect(isProperFraction(2, 3)).toEqual(true);
});
// Case 2: Identify Improper Fractions:
test("should return false for improper fractions", () => {
const improperFraction = isProperFraction(5, 2);
expect(improperFraction).toEqual(false);
});
// Case 3: Identify Negative Fractions:
test("should return true when the absolute value of numerator is less than denominator, even if the fraction is negative", () => {
const negativeFraction = isProperFraction(-4, 7);
expect(negativeFraction).toEqual(true);
});
// Case 4: Identify Equal Numerator and Denominator:
test("should return false for equal numerator and denominator", () => {
const equalFraction = isProperFraction(3, 3);
expect(equalFraction).toEqual(false);
});