Skip to content

Commit 3d63709

Browse files
committed
fixed handling negative numbers in fractions
1 parent cbfdf80 commit 3d63709

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,15 @@ test("should return false when numerator is equal to or greater than denominator
1515
expect(isProperFraction(10, 3)).toEqual(false);
1616
});
1717

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);
18+
test("should return true for proper fractions with negative numbers", () => {
19+
expect(isProperFraction(-1, 2)).toEqual(true);
20+
expect(isProperFraction(1, -2)).toEqual(true);
21+
expect(isProperFraction(-4, -5)).toEqual(true);
22+
});
23+
24+
test("shold return false for improper fractions with negative numbers", () => {
25+
expect(isProperFraction(-9, 5)).toEqual(false);
26+
expect(isProperFraction(4, -3)).toEqual(false);
2127
});
2228

2329
// Special case: numerator is zero

0 commit comments

Comments
 (0)