Skip to content

Commit 002211b

Browse files
committed
Added comprehensive Jest tests for isProperFraction function
1 parent b490736 commit 002211b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

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

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

0 commit comments

Comments
 (0)