Skip to content

Instantly share code, notes, and snippets.

@iest
Last active July 28, 2016 08:22
Show Gist options
  • Save iest/b5a6d94a52701d8fcdc3f4408cacc6b5 to your computer and use it in GitHub Desktop.
Save iest/b5a6d94a52701d8fcdc3f4408cacc6b5 to your computer and use it in GitHub Desktop.
Tape
import test from 'tape';
import { mToKm } from '../distance-util';
test('mToKm', (assert) => {
assert.equal(typeof(mToKm(1000)), 'string', 'outputs a string');
assert.equal(mToKm(1000), '1.0', 'converts meters to kilometers');
assert.equal(mToKm(1200), '1.2', 'formatted to 1 decimal place');
assert.equal(mToKm(1299), '1.3', 'rounded up correctly');
assert.equal(mToKm(1240), '1.2', 'rounded down correctly');
assert.end();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment