Add Kilometers/Hour to Miles/Hour conversion and reverse

This commit is contained in:
Quentin Oschatz
2018-10-12 21:49:43 +02:00
parent 60e4d3895f
commit 8d5d6cb8bd
7 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,2 @@
const kphToMph = (kph) => 0.621371192 * kph;
module.exports = kphToMph;

View File

@ -0,0 +1,12 @@
const expect = require('expect');
const kphToMph = require('./kphToMph.js');
test('kphToMph is a Function', () => {
expect(kphToMph).toBeInstanceOf(Function);
});
test('Returns mph from kph.', () => {
expect(kphToMph(10)).toBe(6.21371192);
});
test('Returns mph from kph.', () => {
expect(kphToMph(345.4)).toBe(214.62160971679998);
});