Kyoo/api/tests/helpers/studio-helper.ts
2025-03-03 09:36:38 +01:00

32 lines
577 B
TypeScript

import { buildUrl } from "tests/utils";
import { app } from "~/elysia";
export const getShowsByStudio = async (
studio: string,
{
langs,
...opts
}: {
filter?: string;
limit?: number;
after?: string;
sort?: string | string[];
query?: string;
langs?: string;
preferOriginal?: boolean;
},
) => {
const resp = await app.handle(
new Request(buildUrl(`studios/${studio}/shows`, opts), {
method: "GET",
headers: langs
? {
"Accept-Language": langs,
}
: {},
}),
);
const body = await resp.json();
return [resp, body] as const;
};