Skip to content

Commit 389e1d0

Browse files
committed
will you make it
1 parent c818f07 commit 389e1d0

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

will_you_make_it/main.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const zeroFuel = (distanceToPump, mpg, fuelLeft) => {
2+
return distanceToPump <= mpg * fuelLeft;
3+
};
4+
5+
module.exports = zeroFuel;

will_you_make_it/main.test.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
});

0 commit comments

Comments
 (0)