@@ -8,3 +8,37 @@ 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+ // Denominator zero
13+ test ( "should return false when denominator is zero" , ( ) => {
14+ expect ( isProperFraction ( 1 , 0 ) ) . toEqual ( false ) ;
15+ } ) ;
16+
17+ // Proper fractions
18+ test ( "should return true for proper fractions (numerator < denominator)" , ( ) => {
19+ expect ( isProperFraction ( 1 , 2 ) ) . toEqual ( true ) ;
20+ expect ( isProperFraction ( 2 , 3 ) ) . toEqual ( true ) ;
21+ expect ( isProperFraction ( 3 , 4 ) ) . toEqual ( true ) ;
22+ expect ( isProperFraction ( 0 , 5 ) ) . toEqual ( true ) ; // zero numerator is allowed
23+ } ) ;
24+
25+ // Improper fractions
26+ test ( "should return false for improper fractions (numerator >= denominator)" , ( ) => {
27+ expect ( isProperFraction ( 5 , 5 ) ) . toEqual ( false ) ;
28+ expect ( isProperFraction ( 7 , 3 ) ) . toEqual ( false ) ;
29+ } ) ;
30+
31+ // Negative numerators
32+ test ( "should return true when numerator is negative and denominator is positive" , ( ) => {
33+ expect ( isProperFraction ( - 1 , 2 ) ) . toEqual ( true ) ;
34+ } ) ;
35+
36+ // Negative denominators
37+ test ( "should return false when denominator is negative" , ( ) => {
38+ expect ( isProperFraction ( 1 , - 2 ) ) . toEqual ( false ) ;
39+ } ) ;
40+
41+ // Both negative
42+ test ( "should return false when both numerator and denominator are negative" , ( ) => {
43+ expect ( isProperFraction ( - 3 , - 2 ) ) . toEqual ( false ) ;
44+ } ) ;
0 commit comments