feat: Add unit-tests #25

Merged
timharek merged 31 commits from feature-testing into main 2024-04-11 19:10:16 +00:00
2 changed files with 7 additions and 5 deletions
Showing only changes of commit a40830cebb - Show all commits

View File

@ -48,7 +48,8 @@ async function updateFetch(existingSeries: Series): Promise<UpdatedSeries | null
const updateSuccessful = await storage.write(updated); const updateSuccessful = await storage.write(updated);
if (!updateSuccessful) { if (!updateSuccessful) {
throw new Error(`Failed to update series ${existingSeries.id}`); console.log(`Failed to update series ${existingSeries.id}`);
return null;
} }
return updated; return updated;

View File

@ -146,11 +146,12 @@ async function getEpisodeWithDownloadLink(
playbackResponse = body; playbackResponse = body;
} }
if (playbackStatus === STATUS_CODE.OK && playbackResponse) { if (playbackStatus !== STATUS_CODE.OK && !playbackResponse) {
return { ...episode, url: playbackResponse.playable.assets[0].url }; throw new Error(
} else { `Error getting downloadLink for ${episode.episodeId}, serie: ${episode.originalTitle}. Status: ${playbackStatus}`,
throw `Error getting downloadLink for ${episode.episodeId}, serie: ${episode.originalTitle}. Status: ${playbackStatus}`; );
} }
return { ...episode, url: playbackResponse.playable.assets[0].url };
} }
export const nrkRadio = { export const nrkRadio = {