@@ -6,7 +6,75 @@ import { isProperFraction } from "../implement/2-is-proper-fraction.js";
66// TODO: Write tests to cover all cases.
77// What combinations of numerators and denominators should you test?
88
9- test ( "Basic proper fraction" , ( ) => {
9+ test ( "Returns true for a basic proper fraction" , ( ) => {
1010 // Example: 1/2 is a proper fraction
1111 assert . equal ( isProperFraction ( 1 , 2 ) , true ) ;
1212} ) ;
13+
14+ test ( "Returns true for 2/8" , ( ) => {
15+ assert . equal ( isProperFraction ( 2 , 8 ) , true ) ;
16+ } ) ;
17+
18+ test ( "Returns true when the numerator is zero and denominator is positive" , ( ) => {
19+ assert . equal ( isProperFraction ( 0 , 1 ) , true ) ;
20+ } ) ;
21+
22+ test ( "Returns true for 5/8" , ( ) => {
23+ assert . equal ( isProperFraction ( 5 , 8 ) , true ) ;
24+ } ) ;
25+
26+ test ( "Returns true for 8/9" , ( ) => {
27+ assert . equal ( isProperFraction ( 8 , 9 ) , true ) ;
28+ } ) ;
29+
30+ test ( "Returns true for another proper fraction with a smaller numerator" , ( ) => {
31+ assert . equal ( isProperFraction ( 2 , 4 ) , true ) ;
32+ } ) ;
33+
34+ test ( "Returns true when both numerator and denominator is negative" , ( ) => {
35+ assert . equal ( isProperFraction ( - 1 , - 2 ) , true ) ;
36+ } ) ;
37+
38+ test ( "Returns true when the numerator is positive denominator is negative" , ( ) => {
39+ assert . equal ( isProperFraction ( 1 , - 2 ) , true ) ;
40+ } ) ;
41+
42+ test ( "Returns true when the numerator is negative and the denominator is positive" , ( ) => {
43+ assert . equal ( isProperFraction ( - 1 , 2 ) , true ) ;
44+ } ) ;
45+
46+ test ( "Returns false when the numerator is greater than the denominator" , ( ) => {
47+ assert . equal ( isProperFraction ( 9 , 8 ) , false ) ;
48+ } ) ;
49+
50+ test ( "Returns false when numerator is negative and denominator is zero" , ( ) => {
51+ assert . equal ( isProperFraction ( - 1 , 0 ) , false ) ;
52+ } ) ;
53+
54+ test ( "Returns false for 4/2" , ( ) => {
55+ assert . equal ( isProperFraction ( 4 , 2 ) , false ) ;
56+ } ) ;
57+
58+ test ( "Returns false for 5/3" , ( ) => {
59+ assert . equal ( isProperFraction ( 5 , 3 ) , false ) ;
60+ } ) ;
61+
62+ test ( "Returns false for 6/4" , ( ) => {
63+ assert . equal ( isProperFraction ( 6 , 4 ) , false ) ;
64+ } ) ;
65+
66+ test ( "Returns false for 7/1" , ( ) => {
67+ assert . equal ( isProperFraction ( 7 , 1 ) , false ) ;
68+ } ) ;
69+
70+ test ( "Returns false for 15/14" , ( ) => {
71+ assert . equal ( isProperFraction ( 15 , 14 ) , false ) ;
72+ } ) ;
73+
74+ test ( "Returns false when numerator equals denominator" , ( ) => {
75+ assert . equal ( isProperFraction ( 4 , 4 ) , false ) ;
76+ } ) ;
77+
78+ test ( "Returns false when numerator is positive and denominator is zero" , ( ) => {
79+ assert . equal ( isProperFraction ( 1 , 0 ) , false ) ;
80+ } )
0 commit comments