Test entries seeding

This commit is contained in:
Zoe Roux 2025-01-30 19:32:09 +01:00
parent 4424e9b40a
commit 30bf2d9207
No known key found for this signature in database

View File

@ -20,7 +20,7 @@ describe("Serie seeding", () => {
where: eq(shows.id, body.id),
with: {
seasons: { orderBy: seasons.seasonNumber },
entries: true,
entries: { with: { translations: true } },
},
});
@ -31,5 +31,58 @@ describe("Serie seeding", () => {
expect(ret!.entries).toBeArrayOfSize(
madeInAbyss.entries.length + madeInAbyss.extras.length,
);
const ep13 = madeInAbyss.entries.find((x) => x.order === 13)!;
expect(ret!.entries.find((x) => x.order === 13)).toMatchObject({
...ep13,
slug: "made-in-abyss-s1e13",
thumbnail: { source: ep13.thumbnail },
translations: [
{
language: "en",
...ep13.translations.en,
},
],
});
const { number, ...special } = madeInAbyss.entries.find(
(x) => x.kind === "special",
)!;
expect(ret!.entries.find((x) => x.kind === "special")).toMatchObject({
...special,
slug: "made-in-abyss-sp3",
episodeNumber: number,
thumbnail: { source: special.thumbnail },
translations: [
{
language: "en",
...special.translations.en,
},
],
});
const movie = madeInAbyss.entries.find((x) => x.kind === "movie")!;
expect(ret!.entries.find((x) => x.kind === "movie")).toMatchObject({
...movie,
thumbnail: { source: movie.thumbnail },
translations: [
{
language: "en",
...movie.translations.en,
},
],
});
const { name, video, kind, ...extra } = madeInAbyss.extras[0];
expect(ret!.entries.find((x) => x.kind === "extra")).toMatchObject({
...extra,
extraKind: kind,
translations: [
{
language: "extra",
name,
},
],
});
});
});