Files
aniplay-api/src/controllers/episodes/getEpisodeUrl/index.spec.ts
Rushil Perera 0b0078328c fix(aniplay): Migrates to Aniwatch only
Removes Consumet and consolidates episode fetching to use Aniwatch as the sole provider.

This simplifies the codebase and ensures a consistent data source for episodes and URLs.
Also updates `wrangler` and sets `ENABLE_ANIFY` to false.
2025-08-08 08:17:47 -07:00

48 lines
1.2 KiB
TypeScript

import { describe, expect, it } from "bun:test";
import app from "~/index";
import { server } from "~/mocks";
server.listen();
describe('requests the "/episodes/:id/url" route', () => {
it("with sources from Aniwatch", async () => {
const response = await app.request(
"/episodes/4/url",
{
method: "POST",
body: JSON.stringify({
episodeNumber: 1,
}),
headers: { "Content-Type": "application/json" },
},
{
ENABLE_ANIFY: "true",
},
);
expect(response.json()).resolves.toEqual({
success: true,
result: {
source:
"https://www032.vipanicdn.net/streamhls/aa804a2400535d84dd59454b28d329fb/ep.1.1712504065.m3u8",
subtitles: [],
audio: [],
},
});
});
it("with no URL from Aniwatch source", async () => {
const response = await app.request("/episodes/-1/url", {
method: "POST",
body: JSON.stringify({
episodeNumber: -1,
}),
headers: { "Content-Type": "application/json" },
});
expect(response.json()).resolves.toEqual({ success: false });
expect(response.status).toBe(404);
});
});