Skip to content

Commit 0c1883b

Browse files
committed
Complete Jest test suite for isProperFraction
1 parent ebb894f commit 0c1883b

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,25 @@ 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 denominator is smaller`, () => {
12+
expect(isProperFraction(4, 2)).toEqual(false);
13+
});
14+
test("should return true when numerator < denominator and both positive", () => {
15+
expect(isProperFraction(1, 2)).toEqual(true);
16+
expect(isProperFraction(3, 5)).toEqual(true);
17+
});
18+
test("should return false when numerator is negative", () => {
19+
expect(isProperFraction(-2, 5)).toEqual(false);
20+
});
21+
test("should return false when denominator is negative", () => {
22+
expect(isProperFraction(2, -5)).toEqual(false);
23+
});
24+
test("should return false when numerator is greater than denominator", () => {
25+
expect(isProperFraction(4, 2)).toEqual(false);
26+
});
27+
test("should return false when numerator is zero", () => {
28+
expect(isProperFraction(0, 5)).toEqual(false);
29+
});
30+
test("should return false when numerator equals denominator", () => {
31+
expect(isProperFraction(4, 4)).toEqual(false);
32+
});

0 commit comments

Comments
 (0)