-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathservice-locator.test.ts
More file actions
25 lines (22 loc) · 972 Bytes
/
service-locator.test.ts
File metadata and controls
25 lines (22 loc) · 972 Bytes
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
import { ChunkPlaylistParser } from '@videojs/hls-parser';
import { ServiceLocator } from '../../src/lib/service-locator';
import { beforeEach, describe, expect, it } from 'vitest';
import { HlsPipelineLoader } from '../../src/lib/pipeline-loaders/hls-pipeline-loader';
describe('Service locator spec', () => {
let serviceLocator: ServiceLocator;
beforeEach(() => {
serviceLocator = new ServiceLocator();
});
it('should create a service locator instance', () => {
expect(serviceLocator).toBeInstanceOf(ServiceLocator);
});
it('should return the chunk hls parser', () => {
expect(serviceLocator.getHlsParser()).toEqual(null);
// set parser
HlsPipelineLoader.setHlsParser(ChunkPlaylistParser);
const ChunkHlsParser = serviceLocator.getHlsParser();
expect(ChunkHlsParser).toBeTypeOf('function');
const parser = ChunkHlsParser ? ChunkHlsParser.create({}) : null;
expect(parser).toBeInstanceOf(ChunkPlaylistParser);
});
});