Files
30-seconds-of-code/test/median.test.js
Angelos Chalaris 91c1de3a45 Additional tests
2018-10-31 21:04:22 +02:00

16 lines
468 B
JavaScript

const expect = require('expect');
const {median} = require('./_30s.js');
test('median is a Function', () => {
expect(median).toBeInstanceOf(Function);
});
test('Returns the median of an array of numbers', () => {
expect(median([5, 6, 50, 1, -5])).toBe(5);
});
test('Returns the median of an array of numbers', () => {
expect(median([1, 2, 3])).toBe(2);
});
test('Returns the median of an array of numbers', () => {
expect(median([1, 2, 3, 4])).toBe(2.5);
});