Skip to content

Commit 6eae005

Browse files
committed
more tests
1 parent b8b495f commit 6eae005

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ const median = require('stats-median').calc;
22

33
module.exports = function (data) {
44
const dataMedian = median(data);
5-
return median(data.map((x) => Math.abs(x - dataMedian)));
5+
return median(data.map(x => Math.abs(x - dataMedian)));
66
};

test.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@ import test from 'ava';
22
import mad from './';
33

44
test('should return expected value', t => {
5-
t.is(mad([1, 1, 2, 2, 4, 6, 9]), 1);
5+
t.is(mad([9, 1, 4, 2, 2, 6, 1]), 1);
6+
7+
t.is(mad([455, 463, 477, 1822, 345, 459, 544, 500, 474, 244, 455, 451, 544,
8+
441, 444, 494, 465, 499, 399, 467, 480, 471, 440, 450, 451, 455, 462,
9+
472, 1992, 1991]), 15);
610
});

0 commit comments

Comments
 (0)