Skip to content

Commit f88c295

Browse files
complete jest test
1 parent 3e3fd1f commit f88c295

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

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

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,44 @@ 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 smaller than denominator `, () => {
11+
expect(isProperFraction(3, 5)).toEqual(true);
12+
});
13+
14+
test(`should return false when numerator is bigger than denominator `, () => {
15+
expect(isProperFraction(6, 2)).toEqual(false);
16+
});
17+
18+
test(`should return true when numerator is zero`, () => {
19+
expect(isProperFraction(0, 2)).toEqual(true);
20+
});
21+
22+
test(`should return true when numerator is negative ans smaller`, () => {
23+
expect(isProperFraction(-4, 6)).toEqual(true);
24+
});
25+
26+
test(`should return false when numerator is negative ans bigger`, () => {
27+
expect(isProperFraction(-8, 6)).toEqual(false);
28+
});
29+
30+
test(`should return true when denominator is negative and bigger`, () => {
31+
expect(isProperFraction(2, -5)).toEqual(true);
32+
});
33+
34+
test(`should return false when denominator is negative ans smaller`, () => {
35+
expect(isProperFraction(4, -3)).toEqual(false);
36+
});
37+
38+
test(`should return correct answer when both is negative`, () => {
39+
expect(isProperFraction(-4, -3)).toEqual(false);
40+
expect(isProperFraction(-1, -3)).toEqual(true);
41+
});
42+
43+
test(`should return true answer when Zero numerator and negative denominator`, () => {
44+
expect(isProperFraction(0, -3)).toEqual(true);
45+
});
46+
47+
test(`should return false when both are zero`, () => {
48+
expect(isProperFraction(0, 0)).toEqual(false);
49+
});

0 commit comments

Comments
 (0)