Skip to content

Commit 1c52048

Browse files
committed
solved 2-is-proper-fraction.test.js
1 parent 5a91c8c commit 1c52048

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,22 @@ const isProperFraction = require("../implement/2-is-proper-fraction");
44

55
// TODO: Write tests in Jest syntax to cover all combinations of positives, negatives, zeros, and other categories.
66

7+
test("should return true for valid proper fractions", () => {
8+
expect(isProperFraction(1, 2)).toEqual(true);
9+
expect(isProperFraction(3, 10)).toEqual(true);
10+
expect(isProperFraction(0, 5)).toEqual(true);
11+
});
12+
13+
test("should return false when numerator is equal to or greater than denominator", () => {
14+
expect(isProperFraction(5, 5)).toEqual(false);
15+
expect(isProperFraction(10, 3)).toEqual(false);
16+
});
17+
18+
test("should return false when numerator or denominator is negative", () => {
19+
expect(isProperFraction(-1, 2)).toEqual(false);
20+
expect(isProperFraction(1, -2)).toEqual(false);
21+
});
22+
723
// Special case: numerator is zero
824
test(`should return false when denominator is zero`, () => {
925
expect(isProperFraction(1, 0)).toEqual(false);

0 commit comments

Comments
 (0)