Skip to content

Commit 29c23e6

Browse files
committed
Rewrite is-proper-fraction test in Jest, covering all cases
1 parent 77f784c commit 29c23e6

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,31 @@ 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+
10+
test(`should return true when numerator is less than denominator`, () => {
11+
expect(isProperFraction(1, 2)).toEqual(true);
12+
});
13+
14+
test(`should return false when numerator is more than denominator`, () => {
15+
expect(isProperFraction(3, 2)).toEqual(false);
16+
});
17+
18+
test(`should return true when denominator is negative`, () => {
19+
expect(isProperFraction(1, -2)).toEqual(true);
20+
});
21+
22+
test(`should return true when nominator is negative`, () => {
23+
expect(isProperFraction(-2, 4)).toEqual(true);
24+
});
25+
26+
test(`should return true with both negatives where numerator is smaller`, () => {
27+
expect(isProperFraction(-2, -4)).toEqual(true);
28+
});
29+
30+
test(`should return false with both negatives where numerator is bigger`, () => {
31+
expect(isProperFraction(-3, -2)).toEqual(false);
32+
});
33+
34+
test(`should return false with equal values`, () => {
35+
expect(isProperFraction(2, 2)).toEqual(false);
36+
});

0 commit comments

Comments
 (0)