@@ -8,3 +8,60 @@ 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+ test ( `should return true when numerator is zero and denominator is non-zero` , ( ) => {
13+ expect ( isProperFraction ( 0 , 5 ) ) . toEqual ( true ) ;
14+ } ) ;
15+
16+ // Proper fractions with positive numbers
17+ test ( `should return true for proper fractions with positive numerator and denominator` , ( ) => {
18+ expect ( isProperFraction ( 1 , 2 ) ) . toEqual ( true ) ;
19+ expect ( isProperFraction ( 3 , 4 ) ) . toEqual ( true ) ;
20+ } ) ;
21+
22+ // Improper fractions with positive numbers
23+ test ( `should return false for improper fractions with positive numerator and denominator` , ( ) => {
24+ expect ( isProperFraction ( 2 , 1 ) ) . toEqual ( false ) ;
25+ expect ( isProperFraction ( 5 , 3 ) ) . toEqual ( false ) ;
26+ } ) ;
27+
28+ // Proper fractions with negative numbers
29+ test ( `should return true for proper fractions with negative numerator and positive denominator` , ( ) => {
30+ expect ( isProperFraction ( - 1 , 2 ) ) . toEqual ( true ) ;
31+ expect ( isProperFraction ( - 3 , 4 ) ) . toEqual ( true ) ;
32+ } ) ;
33+
34+ test ( `should return true for proper fractions with positive numerator and negative denominator` , ( ) => {
35+ expect ( isProperFraction ( 1 , - 2 ) ) . toEqual ( true ) ;
36+ expect ( isProperFraction ( 3 , - 4 ) ) . toEqual ( true ) ;
37+ } ) ;
38+
39+ // Improper fractions with negative numbers
40+ test ( `should return false for improper fractions with negative numerator and positive denominator` , ( ) => {
41+ expect ( isProperFraction ( - 2 , 1 ) ) . toEqual ( false ) ;
42+ expect ( isProperFraction ( - 5 , 3 ) ) . toEqual ( false ) ;
43+ } ) ;
44+ test ( `should return false for improper fractions with positive numerator and negative denominator` , ( ) => {
45+ expect ( isProperFraction ( 2 , - 1 ) ) . toEqual ( false ) ;
46+ expect ( isProperFraction ( 5 , - 3 ) ) . toEqual ( false ) ;
47+ } ) ;
48+
49+ // Special case: both numerator and denominator are zero
50+ test ( `should return false when both numerator and denominator are zero` , ( ) => {
51+ expect ( isProperFraction ( 0 , 0 ) ) . toEqual ( false ) ;
52+ } ) ;
53+
54+ // Numerator equals denominator
55+ test ( "should return false when numerator equals denominator" , ( ) => {
56+ expect ( isProperFraction ( 5 , 5 ) ) . toBe ( false ) ;
57+ expect ( isProperFraction ( - 5 , - 5 ) ) . toBe ( false ) ;
58+ } ) ;
59+
60+ // Both numerator and denominator are negative
61+ test ( "should return true for proper fractions with two negative numbers" , ( ) => {
62+ expect ( isProperFraction ( - 1 , - 3 ) ) . toBe ( true ) ;
63+ } ) ;
64+
65+ test ( "should return false for improper fractions with two negative numbers" , ( ) => {
66+ expect ( isProperFraction ( - 10 , - 2 ) ) . toBe ( false ) ;
67+ } ) ;
0 commit comments