@@ -4,7 +4,74 @@ 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 ( `should return false when denominator is zero` , ( ) => {
7+ // Special case 1 : numerator is zero
8+ test ( `should return false when numerator is zero` , ( ) => {
99 expect ( isProperFraction ( 1 , 0 ) ) . toEqual ( false ) ;
1010} ) ;
11+
12+ // Special case 2: denominator zero
13+ test ( `should return false when denominator is zero` , ( ) => {
14+ expect ( isProperFraction ( 0 , 1 ) ) . toEqual ( false ) ;
15+ } ) ;
16+
17+ // Special case 3: both zero
18+ test ( `should return false when both are zero` , ( ) => {
19+ expect ( isProperFraction ( 0 , 0 ) ) . toEqual ( false ) ;
20+ } ) ;
21+
22+ // Special case 4: numerator is a negative number
23+ test ( `should return false when numerator is negative` , ( ) => {
24+ expect ( isProperFraction ( - 3 , 4 ) ) . toEqual ( false ) ;
25+ } ) ;
26+
27+ // Special case 5: denominator is a negative number
28+ test ( `should return false when denominator is negative` , ( ) => {
29+ expect ( isProperFraction ( 3 , - 4 ) ) . toEqual ( false ) ;
30+ } ) ;
31+
32+ // Special case 6: numerator -3 and denominator -4
33+ test ( `should return false when numerator -3 and denominator -4` , ( ) => {
34+ expect ( isProperFraction ( - 3 , - 4 ) ) . toEqual ( false ) ;
35+ } ) ;
36+
37+ // Special case 7: negative equal values
38+ test ( `should return false when both negative equal values` , ( ) => {
39+ expect ( isProperFraction ( - 6 , - 6 ) ) . toEqual ( false ) ;
40+ } ) ;
41+
42+ // Special case 8: equal values
43+ test ( `should return false when both are equal` , ( ) => {
44+ expect ( isProperFraction ( 5 , 5 ) ) . toEqual ( false ) ;
45+ } ) ;
46+
47+ // Special case 9: numerator is a negative number
48+ test ( `should return false when numerator is negative` , ( ) => {
49+ expect ( isProperFraction ( - 3 , 4 ) ) . toEqual ( false ) ;
50+ } ) ;
51+
52+ // Non special cases
53+
54+ // Case ase 10: numerator 1 denominator 2
55+ test ( `should return false when numerator 1 denominator 2` , ( ) => {
56+ expect ( isProperFraction ( 1 , 2 ) ) . toEqual ( true ) ;
57+ } ) ;
58+
59+ // Case ase 11: numerator 3 denominator 4
60+ test ( `should return false when numerator 3 denominator 4` , ( ) => {
61+ expect ( isProperFraction ( 3 , 4 ) ) . toEqual ( true ) ;
62+ } ) ;
63+
64+ // Case ase 12: numerator 5 denominator 8
65+ test ( `should return false when numerator 5 denominator 8` , ( ) => {
66+ expect ( isProperFraction ( 5 , 8 ) ) . toEqual ( true ) ;
67+ } ) ;
68+
69+ // Case ase 13: numerator 7 denominator 4
70+ test ( `should return false when 7 denominator 4` , ( ) => {
71+ expect ( isProperFraction ( 7 , 4 ) ) . toEqual ( false ) ;
72+ } ) ;
73+
74+ // Case ase 14: numerator 9 denominator 5
75+ test ( `should return false when numerator 9 denominator 5` , ( ) => {
76+ expect ( isProperFraction ( 9 , 5 ) ) . toEqual ( false ) ;
77+ } ) ;
0 commit comments