@@ -8,3 +8,21 @@ 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+ // proper fractions
12+ test ( `should return true when denominator is higher than numerator` , ( ) => {
13+ expect ( isProperFraction ( 0 , 1 ) ) . toEqual ( true ) ;
14+ expect ( isProperFraction ( 2 , 7 ) ) . toEqual ( true ) ;
15+ expect ( isProperFraction ( 89 , 101 ) ) . toEqual ( true ) ;
16+ } ) ;
17+ // Special case: numerator or denominator is negative, we consider the absolute values for fractions so ignore the negative signs
18+ test ( `should return true when negative/positive numerator is less than the positive/negative denominator` , ( ) => {
19+ expect ( isProperFraction ( - 20 , - 30 ) ) . toEqual ( true ) ;
20+ expect ( isProperFraction ( - 1 , 2 ) ) . toEqual ( true ) ;
21+ expect ( isProperFraction ( 58 , - 68 ) ) . toEqual ( true ) ;
22+ } ) ;
23+ // Special case: numerator or denominator is negative, we consider the absolute values for fractions so ignore the negative signs
24+ test ( `should return false when negative/positive numerator is greater than the positive/negative denominator` , ( ) => {
25+ expect ( isProperFraction ( - 50 , 10 ) ) . toEqual ( false ) ;
26+ expect ( isProperFraction ( 100 , 2 ) ) . toEqual ( false ) ;
27+ expect ( isProperFraction ( - 1 , - 0 ) ) . toEqual ( false ) ;
28+ } ) ;
0 commit comments