You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js
+31-3Lines changed: 31 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -19,14 +19,42 @@ test(`should return false when both numerator and denominator are zero`, () => {
19
19
expect(isProperFraction(0,0)).toEqual(false);
20
20
});
21
21
22
-
// case: the absolute value of the numerater is less than the absolute value of the denominater (proper fraction)
22
+
// case: both values are positive and the value of the numerater is less than the value of the denominater (proper fraction)
23
23
test(`should return true for positive proper fraction`,()=>{
24
24
expect(isProperFraction(1,2)).toEqual(true);
25
25
});
26
26
27
-
// case: the absolute value of the denominater is less than the absolute value of the numerater (improper fraction)
27
+
// case: both values are positive and the value of the denominater is less than the value of the numerater (improper fraction)
28
28
test(`should return false for positive improper fraction`,()=>{
29
29
expect(isProperFraction(2,1)).toEqual(false);
30
30
});
31
31
32
-
// no need to test the cases where the denominator or numerator or both are negative as I used their absolute value in the function.
32
+
// case: the value of the numerater is negative and its absolute value is less than the value of the denominater (roper fraction)
33
+
test(`should return false for proper fraction`,()=>{
34
+
expect(isProperFraction(-1,2)).toEqual(true);
35
+
});
36
+
37
+
// case: the value of the numerater is negative and its absolute value is greater than the value of the denominater (improper fraction)
38
+
test(`should return false for improper fraction`,()=>{
39
+
expect(isProperFraction(-2,1)).toEqual(false);
40
+
});
41
+
42
+
// case: the value of the denominator is negative and its absolute value is greater than the value of the numerator (proper fraction)
43
+
test(`should return true for proper fraction`,()=>{
44
+
expect(isProperFraction(1,-2)).toEqual(true);
45
+
});
46
+
47
+
// case: the value of the denominator is negative and its absolute value is less than the value of the numerator (improper fraction)
48
+
test(`should return false for improper fraction`,()=>{
49
+
expect(isProperFraction(2,-1)).toEqual(false);
50
+
});
51
+
52
+
// 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)
53
+
test(`should return true for proper fraction`,()=>{
54
+
expect(isProperFraction(-1,-2)).toEqual(true);
55
+
});
56
+
57
+
// 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)
58
+
test(`should return false for improper fraction`,()=>{
0 commit comments