test(media): cover cards and virtual slides (#558)

This commit is contained in:
InfinityPacer
2026-07-18 18:03:39 +08:00
committed by GitHub
parent 395401e493
commit c491195b19
8 changed files with 1174 additions and 24 deletions

View File

@@ -5,11 +5,23 @@ const API_BASE_URL = 'http://localhost/api/v1/'
export const mediaApiUrls = {
episodeGroups: (tmdbId: number) => new URL(`media/groups/${tmdbId}`, API_BASE_URL).href,
exists: new URL('mediaserver/exists', API_BASE_URL).href,
groupSeasons: (episodeGroup: string) => new URL(`media/group/seasons/${episodeGroup}`, API_BASE_URL).href,
notExists: new URL('mediaserver/notexists', API_BASE_URL).href,
seasons: new URL('media/seasons', API_BASE_URL).href,
}
export function mediaExistsHandler(
response: { data?: Record<string, unknown>; message?: string; success: boolean },
status = 200,
onRequest: (url: URL) => void | Promise<void> = () => {},
) {
return http.get(mediaApiUrls.exists, async ({ request }) => {
await onRequest(new URL(request.url))
return HttpResponse.json(response as JsonBodyType, { status })
})
}
export function mediaDetailsHandler(
tmdbId: number,
response: MediaInfo,