Skip to content

Commit 5cec9c4

Browse files
committed
Add test in Jest syntax
1 parent 956f635 commit 5cec9c4

1 file changed

Lines changed: 37 additions & 1 deletion

File tree

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

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,43 @@ const isProperFraction = require("../implement/2-is-proper-fraction");
44

55
// TODO: Write tests in Jest syntax to cover all combinations of positives, negatives, zeros, and other categories.
66

7-
// Special case: numerator is zero
7+
// Special case: denominator is zero
88
test(`should return false when denominator is zero`, () => {
99
expect(isProperFraction(1, 0)).toEqual(false);
1010
});
11+
12+
13+
// Special case: numerator is zero
14+
test(`should return false when numerator is zero`, () => {
15+
expect(isProperFraction(0, 1)).toEqual(false);
16+
});
17+
18+
19+
// Special case: numerator is equal to denominators is a proper fraction
20+
test(`should return false when numerator is equal to denominator`, () => {
21+
expect(isProperFraction(2, 2)).toEqual(false);
22+
});
23+
24+
25+
// Special case: numerator is negative is a proper fraction
26+
test(`should return false when numerator is negative value`, () => {
27+
expect(isProperFraction(-1, 2)).toEqual(false);
28+
});
29+
30+
31+
// Special case: denominator is negative is a proper fraction
32+
test(`should return false denominator is negative value `, () => {
33+
expect(isProperFraction(1, -2)).toEqual(false);
34+
});
35+
36+
37+
// Special case: numerator and denominator are both negative values is a proper fraction//
38+
test(`should return true when numerator ans denominator are both negative values `, () => {
39+
expect(isProperFraction(-5, -6)).toEqual(true);
40+
});
41+
42+
43+
// Special case: negative numerator with smaller value then negative dominator is a proper fraction
44+
test(`should return false when negative numerator is smaller than negative denominator `, () => {
45+
expect(isProperFraction(-6, -5)).toEqual(false);
46+
});

0 commit comments

Comments
 (0)