42 lines
1.6 KiB
TypeScript
42 lines
1.6 KiB
TypeScript
import { getVideoId } from '../../src/helpers/video';
|
|
import { mount } from '@vue/test-utils';
|
|
import SrfEmbed from '@/components/videos/SrfEmbed.vue';
|
|
|
|
describe('Legacy SRF Video Embed', () => {
|
|
const videoId = '6db02b8b-975c-4e3e-8260-f1e6eca1d8ed';
|
|
const url = `https://www.srf.ch/play/tv/popupvideoplayer?id=${videoId}`;
|
|
const embedUrl = `https://www.srf.ch/play/embed?urn=urn:srf:video:${videoId}&subdivisions=false`;
|
|
it('should return the correct embed url', () => {
|
|
const extractedId = getVideoId(url);
|
|
expect(extractedId).toBe(videoId);
|
|
});
|
|
it('should construct the correct iframe', () => {
|
|
const props = {
|
|
url,
|
|
};
|
|
const wrapper = mount(SrfEmbed, {
|
|
props,
|
|
});
|
|
expect(wrapper.attributes('src')).toBe(embedUrl);
|
|
});
|
|
});
|
|
describe('New SRF Video Embed', () => {
|
|
const videoId = '6db02b8b-975c-4e3e-8260-f1e6eca1d8ed';
|
|
const url = `https://www.srf.ch/play/tv/we-myself--why/video/nein-sagen-so-klappt-es?urn=urn:srf:video:${videoId}`;
|
|
const embedUrl = `https://www.srf.ch/play/embed?urn=urn:srf:video:${videoId}&subdivisions=false`;
|
|
it('should return the correct embed url', () => {
|
|
const extractedId = getVideoId(embedUrl);
|
|
expect(extractedId).toBe(videoId);
|
|
});
|
|
it('should construct the correct iframe', () => {
|
|
const props = {
|
|
url,
|
|
};
|
|
const wrapper = mount(SrfEmbed, {
|
|
props,
|
|
});
|
|
expect(wrapper.attributes('src')).toBe(embedUrl);
|
|
});
|
|
});
|
|
// <iframe width="560" height="315" src="https://www.srf.ch/play/embed?urn=urn:srf:video:6db02b8b-975c-4e3e-8260-f1e6eca1d8ed&subdivisions=false" allowfullscreen allow="geolocation *; autoplay; encrypted-media"></iframe>
|