1- // This statement loads the isProperFraction function you wrote in the implement directory.
21const isProperFraction = require ( "../implement/2-is-proper-fraction" ) ;
32
3+ test ( `should return false when denominator is zero` , ( ) => {
4+ expect ( isProperFraction ( 1 , 0 ) ) . toEqual ( false ) ;
5+ } ) ;
6+
47test ( `should return true when |numerator| < |denominator|` , ( ) => {
58 expect ( isProperFraction ( 1 , 2 ) ) . toEqual ( true ) ;
6- expect ( isProperFraction ( - 1 , 2 ) ) . toEqual ( true ) ;
7- expect ( isProperFraction ( 1 , - 2 ) ) . toEqual ( true ) ;
8- expect ( isProperFraction ( - 1 , - 2 ) ) . toEqual ( true ) ;
9+ expect ( isProperFraction ( 3 , 7 ) ) . toEqual ( true ) ;
910} ) ;
1011
1112test ( `should return false when |numerator| >= |denominator|` , ( ) => {
1213 expect ( isProperFraction ( 2 , 1 ) ) . toEqual ( false ) ;
1314 expect ( isProperFraction ( 3 , 3 ) ) . toEqual ( false ) ;
1415} ) ;
1516
16- test ( `should handle negative numerator: return abs(n) < abs(d) ` , ( ) => {
17+ test ( `should return true when numerator is negative and |numerator| < |denominator| ` , ( ) => {
1718 expect ( isProperFraction ( - 1 , 2 ) ) . toEqual ( true ) ;
1819 expect ( isProperFraction ( - 3 , 2 ) ) . toEqual ( false ) ;
1920} ) ;
2021
21- test ( `should handle negative denominator: return abs(n) < abs(d) ` , ( ) => {
22+ test ( `should return true when denominator is negative and |numerator| < |denominator| ` , ( ) => {
2223 expect ( isProperFraction ( 1 , - 2 ) ) . toEqual ( true ) ;
2324 expect ( isProperFraction ( 3 , - 2 ) ) . toEqual ( false ) ;
24- } ) ;
25+ } ) ;
0 commit comments