File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 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- test ( "should return true for a proper fraction" , ( ) => {
5+ test ( "should return true for a proper fraction, including negatives " , ( ) => {
66 expect ( isProperFraction ( 2 , 3 ) ) . toEqual ( true ) ;
7+ expect ( isProperFraction ( - 2 , 3 ) ) . toEqual ( true ) ;
78 expect ( isProperFraction ( 4 , - 5 ) ) . toEqual ( true ) ;
9+ expect ( isProperFraction ( - 4 , - 5 ) ) . toEqual ( true ) ;
810} ) ;
911
1012// Case 2: Identify Improper Fractions:
11- test ( "should return false for an improper fraction" , ( ) => {
12- expect ( isProperFraction ( 5 , 4 ) ) . toEqual ( false ) ;
13+ test ( "should return false for an improper fraction, including negatives" , ( ) => {
14+ expect ( isProperFraction ( 5 , 4 ) ) . toEqual ( false ) ; // numerator greater than denominator
15+ expect ( isProperFraction ( 5 , - 4 ) ) . toEqual ( false ) ; // negative denominator
16+ expect ( isProperFraction ( - 5 , 4 ) ) . toEqual ( false ) ; // negative numerator
17+ expect ( isProperFraction ( - 5 , - 4 ) ) . toEqual ( false ) ; // both negative
1318} ) ;
1419
1520// Case 3: Identify Negative Fractions:
You can’t perform that action at this time.
0 commit comments