forked from video-dev/hls.js
/
hls.js
41 lines (37 loc) · 1.16 KB
/
hls.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import Hls from '../../src/hls';
import { hlsDefaultConfig } from '../../src/config';
import { expect } from 'chai';
describe('Hls', function () {
describe('bandwidthEstimate', function () {
it('should return a bandwidth estimate', function () {
const MOCKED_ESTIMATE = 2000;
const hls = new Hls();
hls.abrController = {
bwEstimator: {
getEstimate: () => MOCKED_ESTIMATE,
},
};
expect(hls.bandwidthEstimate).to.equal(MOCKED_ESTIMATE);
});
it('should return a default bandwidth estimate', function () {
const hls = new Hls();
expect(hls.bandwidthEstimate).to.equal(
hlsDefaultConfig.abrEwmaDefaultEstimate
);
});
});
describe('destroy', function () {
it('should allow stopLoad() after destroy()', function () {
const hls = new Hls();
hls.destroy();
expect(() => hls.stopLoad()).to.not.throw();
});
it('should not allow startLoad() after destroy()', function () {
const hls = new Hls();
hls.destroy();
expect(() => hls.startLoad()).to.throw(
'Cannot call `startLoad()` on destroyed instance of hls'
);
});
});
});