Skip to content

Commit 2bc76dd

Browse files
committed
Testing the proper fraction with Jest
1 parent 459fc1f commit 2bc76dd

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

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

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,37 @@ 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+
// Special case: numerator is zero
13+
test(`should return true when numerator is zero`, () => {
14+
expect(isProperFraction(0, 5)).toEqual(true);
15+
});
16+
17+
// Special case: positive numerator and denominator
18+
test(`should return true when numerator is less than denominator`, () => {
19+
expect(isProperFraction(7, 9)).toEqual(true);
20+
});
21+
22+
// Special case; negative numerator and positive denominatore
23+
test(` should return true when numertaor is negative and less than demoniator`, () => {
24+
expect(isproperFraction(-5, 9)).toEuqal(true);
25+
});
26+
27+
// special case: postive numerator and negative deminator
28+
test(`should return true when numerator is positive and less than denominator`, () => {
29+
expect(isProperFraction(5, -7)).toEqual(true);
30+
});
31+
32+
// Special case: negative numerator and negative denominator
33+
test(`should return true when both are negative`, () => {
34+
expect(isProperFraction(-5, -7)).toEqual(true);
35+
});
36+
37+
// Special case: Equal values
38+
test(`should return true when numerator and denominator are equal`, () => {
39+
expect(isProperFraction(5, 5)).toEqual(true);
40+
});

0 commit comments

Comments
 (0)