22// We will use the same function, but write tests for it using Jest in this file.
33const isProperFraction = require ( "../implement/2-is-proper-fraction" ) ;
44
5- // TODO: Write tests in Jest syntax to cover all combinations of positives, negatives, zeros, and other categories.
5+ // Write tests in Jest syntax to cover all combinations of positives, negatives, zeros, and other categories.
66
77// Special case: numerator is zero
88test ( `should return false when denominator is zero` , ( ) => {
99 expect ( isProperFraction ( 1 , 0 ) ) . toEqual ( false ) ;
1010} ) ;
11+
12+ // Normal case:
13+ test ( `should return false when denominator is zero` , ( ) => {
14+ expect ( isProperFraction ( 5 , 10 ) ) . toEqual ( true ) ;
15+ } ) ;
16+ // Boundary Value
17+ test ( `should return false when denominator is zero` , ( ) => {
18+ expect ( isProperFraction ( 1 , 0 ) ) . toEqual ( false ) ;
19+ } ) ;
20+ // Improper Fraction
21+ test ( `should return false when denominator is zero` , ( ) => {
22+ expect ( isProperFraction ( 1 , 1 ) ) . toEqual ( false ) ;
23+ } ) ;
24+ // Negative Value
25+ test ( `should return false when denominator is zero` , ( ) => {
26+ expect ( isProperFraction ( - 3 , 8 ) ) . toEqual ( false ) ;
27+
28+ } ) ;
29+ // Very Small
30+ test ( `should return false when denominator is zero` , ( ) => {
31+ expect ( isProperFraction ( 0.0001 , 999999 ) ) . toEqual ( true ) ;
32+ } ) ;
33+ // very large
34+ test ( `should return false when denominator is zero` , ( ) => {
35+ expect ( isProperFraction ( 999999 , 0.0001 ) ) . toEqual ( false ) ;
36+ } ) ;
0 commit comments