Skip to content

Commit af851f3

Browse files
committed
combine the tests with the same description into the same group
1 parent 36e8c14 commit af851f3

File tree

1 file changed

+14
-39
lines changed

1 file changed

+14
-39
lines changed

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

Lines changed: 14 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -7,55 +7,30 @@ const isProperFraction = require("../implement/2-is-proper-fraction");
77
// Special case: denominator is zero (undefined)
88
test(`should return false when denominator is zero`, () => {
99
expect(isProperFraction(1, 0)).toEqual(false);
10-
});
11-
12-
// Special case: numerator is zero (proper fraction)
13-
test(`should return true when numerator is zero`, () => {
14-
expect(isProperFraction(0, 1)).toEqual(true);
15-
});
16-
17-
// Special case: both numerator and denominator are zeros (undefined)
18-
test(`should return false when both numerator and denominator are zero`, () => {
10+
// Special case: both numerator and denominator are zeros (undefined)
1911
expect(isProperFraction(0, 0)).toEqual(false);
2012
});
2113

22-
// case: both values are positive and the value of the numerater is less than the value of the denominater (proper fraction)
14+
// Special case: numerator is zero (proper fraction)
2315
test(`should return true for proper fraction`, () => {
16+
expect(isProperFraction(0, 1)).toEqual(true);
17+
// case: both values are positive and the value of the numerater is less than the value of the denominater (proper fraction)
2418
expect(isProperFraction(1, 2)).toEqual(true);
25-
});
26-
27-
// case: both values are positive and the value of the denominater is less than the value of the numerater (improper fraction)
28-
test(`should return false for improper fraction`, () => {
29-
expect(isProperFraction(2, 1)).toEqual(false);
30-
});
31-
32-
// testing negative cases
33-
// case: the value of the numerater is negative and its absolute value is less than the value of the denominater (roper fraction)
34-
test(`should return false for proper fraction`, () => {
19+
// case: the value of the numerater is negative and its absolute value is less than the value of the denominater (roper fraction)
3520
expect(isProperFraction(-1, 2)).toEqual(true);
36-
});
37-
38-
// case: the value of the numerater is negative and its absolute value is greater than the value of the denominater (improper fraction)
39-
test(`should return false for improper fraction`, () => {
40-
expect(isProperFraction(-2, 1)).toEqual(false);
41-
});
42-
43-
// case: the value of the denominator is negative and its absolute value is greater than the value of the numerator (proper fraction)
44-
test(`should return true for proper fraction`, () => {
21+
// case: the value of the denominator is negative and its absolute value is greater than the value of the numerator (proper fraction)
4522
expect(isProperFraction(1, -2)).toEqual(true);
46-
});
47-
48-
// case: the value of the denominator is negative and its absolute value is less than the value of the numerator (improper fraction)
49-
test(`should return false for improper fraction`, () => {
50-
expect(isProperFraction(2, -1)).toEqual(false);
51-
});
52-
53-
// case: both values of the numerator and denominator are negative and the absolute value of the numerator is less than the absolute value of the denominator (proper fraction)
54-
test(`should return true for proper fraction`, () => {
23+
// case: both values of the numerator and denominator are negative and the absolute value of the numerator is less than the absolute value of the denominator (proper fraction)
5524
expect(isProperFraction(-1, -2)).toEqual(true);
5625
});
5726

58-
// case: both values of the numerator and denominator are negative and the absolute value of the numerator is greater than the absolute value of the denominator (improper fraction)
27+
// case: both values are positive and the value of the denominater is less than the value of the numerater (improper fraction)
5928
test(`should return false for improper fraction`, () => {
29+
expect(isProperFraction(2, 1)).toEqual(false);
30+
// case: the value of the numerater is negative and its absolute value is greater than the value of the denominater (improper fraction)
31+
expect(isProperFraction(-2, 1)).toEqual(false);
32+
// case: both values of the numerator and denominator are negative and the absolute value of the numerator is greater than the absolute value of the denominator (improper fraction)
6033
expect(isProperFraction(-2, -1)).toEqual(false);
34+
// case: the value of the denominator is negative and its absolute value is less than the value of the numerator (improper fraction)
35+
expect(isProperFraction(2, -1)).toEqual(false);
6136
});

0 commit comments

Comments
 (0)