@@ -5,6 +5,34 @@ const isProperFraction = require("../implement/2-is-proper-fraction");
55// TODO: Write tests in Jest syntax to cover all combinations of positives, negatives, zeros, and other categories.
66
77// Special case: numerator is zero
8+
89test ( `should return false when denominator is zero` , ( ) => {
910 expect ( isProperFraction ( 1 , 0 ) ) . toEqual ( false ) ;
1011} ) ;
12+ test ( `should return true when input (1, 2)` , ( ) => {
13+ expect ( isProperFraction ( 1 , 2 ) ) . toEqual ( true ) ;
14+ } ) ;
15+ test ( `should return false when (numerator = 0)` , ( ) => {
16+ expect ( isProperFraction ( 0 , 4 ) ) . toEqual ( false ) ;
17+ } ) ;
18+ test ( `should return false when (numerator===denominator)` , ( ) => {
19+ expect ( isProperFraction ( 5 , 5 ) ) . toEqual ( false ) ;
20+ } ) ;
21+ test ( `should return false when (numerator>denominator)` , ( ) => {
22+ expect ( isProperFraction ( 6 , 5 ) ) . toEqual ( false ) ;
23+ } ) ;
24+ test ( `should return false when (numerator ===0 && denominator === 0)` , ( ) => {
25+ expect ( isProperFraction ( 0 , 0 ) ) . toEqual ( false ) ;
26+ } ) ;
27+ test ( `should return false when numerator is negative number` , ( ) => {
28+ expect ( isProperFraction ( - 4 , 8 ) ) . toEqual ( false ) ;
29+ } ) ;
30+ test ( `should return false when (negative numerator === denominator )` , ( ) => {
31+ expect ( isProperFraction ( - 5 , 5 ) ) . toEqual ( false ) ;
32+ } ) ;
33+ test ( `should return false when ( numerator < negative denominator )` , ( ) => {
34+ expect ( isProperFraction ( 3 , - 5 ) ) . toEqual ( false ) ;
35+ } ) ;
36+ test ( `should return false when numerator is zero and denominator is negative zero` , ( ) => {
37+ expect ( isProperFraction ( 0 , - 0 ) ) . toEqual ( false ) ;
38+ } ) ;
0 commit comments