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); }); }); //