fix(media): 详情页标语只显示简体中文,简中没有时不显示
- adapters 新增 simplifiedChineseTagline:取值语言为繁中 / 非中文、或文字是繁体特有字时不显示;原语言为中文(zh / cn)的作品按简中处理 - TMDB 富详情带回 taglineLanguage;发现页详情的 tagline 按上述口径给出 - 媒体库作品详情新增 displayTagline(存储的标语语言为 null,只能按文字判断);metadata.tagline 存储不变 - 补 adapters 单测与作品详情接口测试 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Cxwgnn2pbzQ7rXv3rq7fei
This commit is contained in:
1 parent
895c039a40
commit
6549ab92c3
9 files changed
+124
-2
No files matched your search
@@ -336,4 +336,32 @@ describe.skipIf(!hasPg)("LIBV-1 入库版本", () => {
|
||||
expect(response.body.data.downloads).toHaveLength(105);
|
||||
expect(response.body.data.droppedPlans).toHaveLength(51);
|
||||
});
|
||||
|
||||
it("作品详情头部标语只给简体中文(displayTagline);存储的 metadata.tagline 不变", async () => {
|
||||
const field = (value: unknown, language: string | null = null) => ({
|
||||
value,
|
||||
source: "tmdb",
|
||||
language,
|
||||
at: "2026-10-01T00:00:00.000Z",
|
||||
locked: false,
|
||||
});
|
||||
const cases: [string, string, string | null][] = [
|
||||
["我们注定要离开地球", "en", "我们注定要离开地球"],
|
||||
["我們註定要離開地球", "en", null],
|
||||
["Mankind was born on Earth.", "en", null],
|
||||
["我們註定要離開地球", "zh", "我們註定要離開地球"],
|
||||
];
|
||||
for (const [tagline, orig, want] of cases) {
|
||||
const entityId = await seedEntity(h.db, { kind: "movie", title: `标语 ${tagline}`, year: 2026 });
|
||||
await h.db
|
||||
.updateTable("media_entity")
|
||||
.set({ metadata: JSON.stringify({ tagline: field(tagline), originalLanguage: field(orig) }) })
|
||||
.where("id", "=", entityId)
|
||||
.execute();
|
||||
const r = await h.api("GET", `/library/${entityId}`);
|
||||
expect(r.status).toBe(200);
|
||||
expect(r.body.data.displayTagline).toBe(want);
|
||||
expect(r.body.data.entity.metadata.tagline.value).toBe(tagline);
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user