File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change
1
+ const zeroFuel = ( distanceToPump , mpg , fuelLeft ) => {
2
+ return distanceToPump <= mpg * fuelLeft ;
3
+ } ;
4
+
5
+ module . exports = zeroFuel ;
Original file line number Diff line number Diff line change
1
+ const zeroFuel = require ( './main' ) ;
2
+
3
+ test ( 'if 2 gallons left and mile per gallon is 25, it\'s possible to reach to pump 50 miles away.' , ( ) => {
4
+ expect ( zeroFuel ( 50 , 25 , 2 ) ) . toBe ( true ) ;
5
+ } ) ;
6
+
7
+ test ( 'if 1 gallons left and mile per gallon is 50, it\'s impossible to reach to pump 100 miles away.' , ( ) => {
8
+ expect ( zeroFuel ( 100 , 50 , 1 ) ) . toBe ( false ) ;
9
+ } ) ;
10
+
11
+ test ( 'if 3 gallons left and mile per gallon is 50, it\'s impossible to reach to pump 100 miles away.' , ( ) => {
12
+ expect ( zeroFuel ( 100 , 50 , 3 ) ) . toBe ( true ) ;
13
+ } ) ;
You can’t perform that action at this time.
0 commit comments