test(e2e): align standalone movie contract

This commit is contained in:
Estrella Pan
2026-07-14 09:01:42 +02:00
parent a99b78931c
commit 45a4e6397a
2 changed files with 23 additions and 4 deletions

View File

@@ -69,8 +69,10 @@ test('changing parser language re-queries the same TMDB title in that locale', a
);
expect(movie).toMatchObject({
official_title: 'ローカライズ映画',
episode_type: 'movie',
});
title_raw: 'Localized Movie',
year: 2026,
group_name: 'E2E',
} satisfies Partial<typeof movie>);
await activateTmdbScenario(environment, 'localized-retry-jp');
const retried = await analyseTmdbFixture(

View File

@@ -22,6 +22,13 @@ export interface BangumiRecord {
[key: string]: unknown;
}
export interface MovieRecord {
official_title: string;
title_raw: string | null;
year: number | null;
group_name: string | null;
}
interface SeedRuleOptions {
title: string;
uniqueName: string;
@@ -99,11 +106,21 @@ export async function mockRequests(
return payload.requests;
}
export function analyseTmdbFixture(
request: APIRequestContext,
environment: E2EEnvironment,
fixture: 'tmdb-movie.xml'
): Promise<MovieRecord>;
export function analyseTmdbFixture(
request: APIRequestContext,
environment: E2EEnvironment,
fixture?: 'tmdb-tv.xml' | 'tmdb-retry.xml'
): Promise<BangumiRecord>;
export async function analyseTmdbFixture(
request: APIRequestContext,
environment: E2EEnvironment,
fixture = 'tmdb-tv.xml'
): Promise<BangumiRecord> {
): Promise<BangumiRecord | MovieRecord> {
const response = await requireStatus(
await request.post('/api/v1/rss/analysis', {
data: {
@@ -116,7 +133,7 @@ export async function analyseTmdbFixture(
}),
200
);
return response.json();
return (await response.json()) as BangumiRecord | MovieRecord;
}
async function analyseParserFixture(