feat: set videoId to '' instead of null on load (#205)
This commit is contained in:
@@ -27,7 +27,7 @@ export const loadVideoData = () => (dispatch, getState) => {
|
||||
});
|
||||
|
||||
dispatch(actions.video.load({
|
||||
videoSource: videoUrl,
|
||||
videoSource: videoUrl || '',
|
||||
videoId,
|
||||
fallbackVideos,
|
||||
allowVideoDownloads: rawVideoData.download_video,
|
||||
@@ -91,7 +91,7 @@ export const determineVideoSources = ({
|
||||
[videoUrl, fallbackVideos] = [html5Sources[0], html5Sources.slice(1)];
|
||||
}
|
||||
return {
|
||||
videoId: edxVideoId,
|
||||
videoId: edxVideoId || '',
|
||||
videoUrl: videoUrl || '',
|
||||
fallbackVideos: fallbackVideos || [],
|
||||
};
|
||||
|
||||
@@ -181,6 +181,19 @@ describe('video thunkActions', () => {
|
||||
const youtubeId = 'yOuTuBEiD';
|
||||
const youtubeUrl = `https://youtu.be/${youtubeId}`;
|
||||
const html5Sources = ['htmLOne', 'hTMlTwo', 'htMLthrEE'];
|
||||
describe('when edx id, youtube id and source values are null', () => {
|
||||
it('returns empty strings for ids and an empty array for sources', () => {
|
||||
expect(thunkActions.determineVideoSources({
|
||||
edxVideoId: null,
|
||||
youtubeId: null,
|
||||
html5Sources: null,
|
||||
})).toEqual({
|
||||
videoUrl: '',
|
||||
videoId: '',
|
||||
fallbackVideos: [],
|
||||
});
|
||||
});
|
||||
});
|
||||
describe('when there is an edx video id, youtube id and html5 sources', () => {
|
||||
it('returns all three with the youtube id wrapped in url', () => {
|
||||
expect(thunkActions.determineVideoSources({
|
||||
|
||||
Reference in New Issue
Block a user