11import { isProperFraction } from "../implement/2-is-proper-fraction.js" ;
22
3- // TODO: Write tests in Jest syntax to cover all combinations of positives, negatives, zeros, and other categories.
4-
5- // Special case: numerator is zero
6- test ( `should return false when denominator is zero` , ( ) => {
3+ test ( "should return false when the denominator is zero" , ( ) => {
74 expect ( isProperFraction ( 1 , 0 ) ) . toEqual ( false ) ;
5+ expect ( isProperFraction ( 0 , 0 ) ) . toEqual ( false ) ;
86} ) ;
7+
98test ( "should return true for a proper fraction" , ( ) => {
109 expect ( isProperFraction ( 1 , 2 ) ) . toEqual ( true ) ;
1110} ) ;
1211
13- test ( "should return false when numerator equals denominator" , ( ) => {
12+ test ( "should return false when the numerator and denominator have equal magnitudes " , ( ) => {
1413 expect ( isProperFraction ( 5 , 5 ) ) . toEqual ( false ) ;
14+ expect ( isProperFraction ( - 5 , - 5 ) ) . toEqual ( false ) ;
1515} ) ;
1616
17- test ( "should return false when numerator is greater than denominator" , ( ) => {
17+ test ( "should return false when the numerator's magnitude exceeds the denominator's " , ( ) => {
1818 expect ( isProperFraction ( 7 , 3 ) ) . toEqual ( false ) ;
19+ expect ( isProperFraction ( - 7 , 3 ) ) . toEqual ( false ) ;
1920} ) ;
2021
2122test ( "should return true when numerator is zero" , ( ) => {
2223 expect ( isProperFraction ( 0 , 5 ) ) . toEqual ( true ) ;
24+ expect ( isProperFraction ( 0 , - 5 ) ) . toEqual ( true ) ;
2325} ) ;
2426
2527test ( "should return true when both numerator and denominator are negative and form a proper fraction" , ( ) => {
@@ -30,6 +32,10 @@ test("should return true for negative numerator and positive denominator", () =>
3032 expect ( isProperFraction ( - 1 , 2 ) ) . toEqual ( true ) ;
3133} ) ;
3234
33- test ( "should return false for positive numerator and negative denominator" , ( ) => {
34- expect ( isProperFraction ( 1 , - 2 ) ) . toEqual ( false ) ;
35+ test ( "should return true for positive numerator and negative denominator when the numerator is smaller" , ( ) => {
36+ expect ( isProperFraction ( 1 , - 2 ) ) . toEqual ( true ) ;
37+ } ) ;
38+
39+ test ( "should return false for negative numerator and positive denominator when the numerator is larger" , ( ) => {
40+ expect ( isProperFraction ( - 3 , 2 ) ) . toEqual ( false ) ;
3541} ) ;
0 commit comments