Skip to content

Commit c9cc257

Browse files
committed
Add proper fraction tests
1 parent d58fb5e commit c9cc257

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

‎implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,30 @@ import { isProperFraction } from "../implement/2-is-proper-fraction.js";
66
test(`should return false when denominator is zero`, () => {
77
expect(isProperFraction(1, 0)).toEqual(false);
88
});
9+
test("should return true for a proper fraction", () => {
10+
expect(isProperFraction(1, 2)).toEqual(true);
11+
});
12+
13+
test("should return false when numerator equals denominator", () => {
14+
expect(isProperFraction(5, 5)).toEqual(false);
15+
});
16+
17+
test("should return false when numerator is greater than denominator", () => {
18+
expect(isProperFraction(7, 3)).toEqual(false);
19+
});
20+
21+
test("should return true when numerator is zero", () => {
22+
expect(isProperFraction(0, 5)).toEqual(true);
23+
});
24+
25+
test("should return false for negative numerator and denominator", () => {
26+
expect(isProperFraction(-1, -2)).toEqual(false);
27+
});
28+
29+
test("should return true for negative numerator and positive denominator", () => {
30+
expect(isProperFraction(-1, 2)).toEqual(true);
31+
});
32+
33+
test("should return false for positive numerator and negative denominator", () => {
34+
expect(isProperFraction(1, -2)).toEqual(false);
35+
});

0 commit comments

Comments
 (0)