Skip to content

Commit 8a0a7c3

Browse files
committed
Add Jest tests for isProperFraction covering all combinations
1 parent 2973a05 commit 8a0a7c3

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,21 @@ const isProperFraction = require("../implement/2-is-proper-fraction");
88
test(`should return false when denominator is zero`, () => {
99
expect(isProperFraction(1, 0)).toEqual(false);
1010
});
11+
test("should return false when numerator is greater than denominator", () => {
12+
expect(isProperFraction(5, 2)).toEqual(false);
13+
});
14+
test("should return true when absolute numerator is less than absolute denominator", () => {
15+
expect(isProperFraction(-4, 7)).toEqual(true);
16+
});
17+
test("should return false when numerator equals denominator", () => {
18+
expect(isProperFraction(3, 3)).toEqual(false);
19+
});
20+
test("should return true when numerator < |denominator| and denominator is negative", () => {
21+
expect(isProperFraction(4, -7)).toEqual(true);
22+
});
23+
test("should return true when numerator and denominator are both negative and |numerator| < |denominator|", () => {
24+
expect(isProperFraction(-4, -7)).toEqual(true);
25+
});
26+
test("should return true when numerator is zero and denominator is negative", () => {
27+
expect(isProperFraction(0, -5)).toEqual(true);
28+
});

0 commit comments

Comments
 (0)