test: Add test for getEpisodeWithDownloadLink

Signed-off-by: Tim Hårek Andreassen <tim@harek.no>
This commit is contained in:
Tim Hårek Andreassen 2024-04-07 00:07:44 +02:00
parent 2c1d6a3dca
commit f30497a76b
No known key found for this signature in database
GPG Key ID: E59C7734F0E10EB5
2 changed files with 13 additions and 0 deletions

View File

@ -125,3 +125,7 @@ export const nrkRadio = {
getSerieData, getSerieData,
getEpisode, getEpisode,
}; };
export const forTestingOnly = {
getEpisodeWithDownloadLink,
};

View File

@ -2,6 +2,7 @@ import { assertEquals } from "$std/assert/assert_equals.ts";
import { nrkRadio } from "./nrk.ts"; import { nrkRadio } from "./nrk.ts";
import { assertGreaterOrEqual } from "$std/assert/assert_greater_or_equal.ts"; import { assertGreaterOrEqual } from "$std/assert/assert_greater_or_equal.ts";
import { assertExists } from "https://deno.land/std@0.216.0/assert/assert_exists.ts"; import { assertExists } from "https://deno.land/std@0.216.0/assert/assert_exists.ts";
import { forTestingOnly } from "./nrk.ts";
Deno.test("Verify search query `trygd` returns one result: 'Trygdekontoret'", async () => { Deno.test("Verify search query `trygd` returns one result: 'Trygdekontoret'", async () => {
const result = await nrkRadio.search("trygd"); const result = await nrkRadio.search("trygd");
@ -40,3 +41,11 @@ Deno.test("Verify getting episodeId 'null' for 'trygdekontoret' yields `null`",
assertEquals(result, null); assertEquals(result, null);
}); });
Deno.test("Verify getting episode, 'l_0bc5e55a-46b5-48a5-85e5-5a46b5d8a562' with download link works`", async () => {
const series = await nrkRadio.getSerieData("trygdekontoret");
assertExists(series);
const result = await forTestingOnly.getEpisodeWithDownloadLink(series.episodes[0], "podcast");
assertExists(result);
});