mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import { correctVideoSource } from '../../src/utils/correctVideoSource';
|
|
|
|
describe('correctVideoSource', () => {
|
|
test('simple', () => {
|
|
expect(correctVideoSource(undefined, [])).toEqual([]);
|
|
expect(correctVideoSource([], [])).toEqual([]);
|
|
|
|
expect(correctVideoSource([{
|
|
type: 'video_source',
|
|
url: 'abcde',
|
|
mime_type: 'def'
|
|
}], [])).toEqual([{
|
|
src: 'abcde',
|
|
type: 'def'
|
|
}]);
|
|
});
|
|
|
|
test('incorrect', () => {
|
|
expect(correctVideoSource({
|
|
//@ts-expect-error incorrect type
|
|
type: 'video2',
|
|
video_sources: [{
|
|
type: 'video_source',
|
|
url: 'abcde'
|
|
}]
|
|
}, [])).toEqual([]);
|
|
|
|
//@ts-expect-error missing type
|
|
expect(correctVideoSource([{
|
|
url: 'abcde',
|
|
mime_type: 'video/abc'
|
|
}], [])).toEqual([]);
|
|
|
|
//@ts-expect-error missing url
|
|
expect(correctVideoSource([{
|
|
type: 'video_source'
|
|
}], [])).toEqual([]);
|
|
});
|
|
});
|