@@ -4,27 +4,30 @@ const isProperFraction = require("../implement/2-is-proper-fraction");
44
55// TODO: Write tests in Jest syntax to cover all combinations of positives, negatives, zeros, and other categories.
66
7- // Special case: numerator is zero
8- test ( "returns false when denominator is zero" , ( ) => {
9- expect ( isProperFraction ( 1 , 0 ) ) . toEqual ( false ) ;
7+ test ( "returns true when |numerator| < |denominator|" , ( ) => {
8+ expect ( isProperFraction ( 1 , 2 ) ) . toEqual ( true ) ;
9+ } ) ;
10+
11+ test ( "returns true when numerator is zero" , ( ) => {
12+ expect ( isProperFraction ( 0 , 5 ) ) . toEqual ( true ) ;
1013} ) ;
1114
12- test ( "returns false when numerator is zero " , ( ) => {
13- expect ( isProperFraction ( 0 , 1 ) ) . toEqual ( false ) ;
15+ test ( "returns false when | numerator| > |denominator| " , ( ) => {
16+ expect ( isProperFraction ( 3 , 2 ) ) . toEqual ( false ) ;
1417} ) ;
1518
16- test ( "returns false when numerator > denominator" , ( ) => {
17- expect ( isProperFraction ( 2 , 1 ) ) . toEqual ( false ) ;
19+ test ( "returns false when | numerator| = | denominator| " , ( ) => {
20+ expect ( isProperFraction ( 5 , 5 ) ) . toEqual ( false ) ;
1821} ) ;
1922
20- test ( "returns false when numerator is negative " , ( ) => {
21- expect ( isProperFraction ( - 2 , 2 ) ) . toEqual ( false ) ;
23+ test ( "returns false when denominator is zero " , ( ) => {
24+ expect ( isProperFraction ( 1 , 0 ) ) . toEqual ( false ) ;
2225} ) ;
2326
24- test ( "returns false when denominator is negative" , ( ) => {
25- expect ( isProperFraction ( 2 , - 2 ) ) . toEqual ( false ) ;
27+ test ( "returns true when denominator is negative but |numerator| < |denominator| " , ( ) => {
28+ expect ( isProperFraction ( 2 , - 4 ) ) . toEqual ( true ) ;
2629} ) ;
2730
28- test ( "returns false when both numerator and denominator are negative" , ( ) => {
29- expect ( isProperFraction ( - 3 , - 4 ) ) . toEqual ( false ) ;
31+ test ( "returns true when both numbers are negative but |numerator| < |denominator| " , ( ) => {
32+ expect ( isProperFraction ( - 3 , - 4 ) ) . toEqual ( true ) ;
3033} ) ;
0 commit comments