@@ -8,3 +8,38 @@ const isProperFraction = require("../implement/2-is-proper-fraction");
88test ( `should return false when denominator is zero` , ( ) => {
99 expect ( isProperFraction ( 1 , 0 ) ) . toEqual ( false ) ;
1010} ) ;
11+
12+ //
13+
14+ // This statement loads the isProperFraction function
15+ const isProperFraction = require ( "../implement/2-is-proper-fraction" ) ;
16+
17+ // Case 1: denominator is zero
18+ test ( `should return false when denominator is zero` , ( ) => {
19+ expect ( isProperFraction ( 1 , 0 ) ) . toEqual ( false ) ;
20+ } ) ;
21+
22+ // Case 2: numerator is zero
23+ test ( `should return true when numerator is zero and denominator is non-zero` , ( ) => {
24+ expect ( isProperFraction ( 0 , 5 ) ) . toEqual ( true ) ;
25+ } ) ;
26+
27+ // Case 3: positive proper fractions
28+ test ( `should return true for positive proper fractions` , ( ) => {
29+ expect ( isProperFraction ( 1 , 2 ) ) . toEqual ( true ) ;
30+ expect ( isProperFraction ( 3 , 4 ) ) . toEqual ( true ) ;
31+ } ) ;
32+
33+ // Case 4: positive improper fractions
34+ test ( `should return false when numerator is equal or greater` , ( ) => {
35+ expect ( isProperFraction ( 5 , 5 ) ) . toEqual ( false ) ;
36+ expect ( isProperFraction ( 7 , 4 ) ) . toEqual ( false ) ;
37+ } ) ;
38+
39+ // Case 5: negative fractions
40+ test ( `should correctly handle negative values` , ( ) => {
41+ expect ( isProperFraction ( - 1 , 3 ) ) . toEqual ( true ) ;
42+ expect ( isProperFraction ( - 5 , 2 ) ) . toEqual ( false ) ;
43+ expect ( isProperFraction ( 1 , - 3 ) ) . toEqual ( true ) ;
44+ expect ( isProperFraction ( - 1 , - 2 ) ) . toEqual ( true ) ;
45+ } ) ;
0 commit comments