1
0
mirror of https://github.com/videojs/video.js.git synced 2024-12-12 11:15:04 +02:00
video.js/test/unit/utils/median.test.js
Grzegorz Blaszczyk 714aba0ca8 fix: make live UI button more consistent (#6201)
Use a simple moving average for setting the seekableIncrement value, which is used to determine whether we're at the live edge of nor.
2019-08-28 13:41:32 -04:00

25 lines
610 B
JavaScript

/* eslint-env qunit */
import median from '../../../src/js/utils/median.js';
QUnit.module('median');
QUnit.test('should compute the median', function(assert) {
let data;
let expected;
data = [2, 4, 5, 3, 8, 2];
expected = 3.5;
assert.equal(median(data), expected, 'median is correct for the first not sorted array');
data = [2, 4, 5, 3, 8, 2, 9];
expected = 4;
assert.equal(median(data), expected, 'median is correct for the second not sorted array');
data = [2, 2, 3, 4, 5, 8, 9];
expected = 4;
assert.equal(median(data), expected, 'median is correct for the sorted array');
});