fix(plugins): mangabaka type-specific external id namespaces
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
d9f935d8a8
commit
2573c83f70
@@ -22,10 +22,10 @@ function hint(e: ApiEntry): WorkHint {
|
||||
const add = (ns: string, v: { id?: number | string | null } | null | undefined) => {
|
||||
if (v?.id != null && v.id !== "") externalIds[ns] = String(v.id);
|
||||
};
|
||||
add("anilist", s?.source?.anilist);
|
||||
add("mal", s?.source?.my_anime_list);
|
||||
add("anilist_manga", s?.source?.anilist);
|
||||
add("mal_manga", s?.source?.my_anime_list);
|
||||
add("mangaupdates", s?.source?.manga_updates);
|
||||
add("kitsu", s?.source?.kitsu);
|
||||
add("kitsu_manga", s?.source?.kitsu);
|
||||
return {
|
||||
title: s?.title ?? `MangaBaka series ${e.series_id}`,
|
||||
mediaType: s?.type === "comic" ? "comic" : "manga",
|
||||
|
||||
@@ -36,7 +36,7 @@ describe("mangabaka", () => {
|
||||
const a = recs[0]!;
|
||||
if (a.kind !== "entry") throw new Error();
|
||||
expect(a.entry).toEqual({ status: "in_progress", rating: 80, notes: "good" });
|
||||
expect(a.work.externalIds).toEqual({ mangabaka: "1", anilist: "11", mal: "22", mangaupdates: "33", kitsu: "44" });
|
||||
expect(a.work.externalIds).toEqual({ mangabaka: "1", anilist_manga: "11", mal_manga: "22", mangaupdates: "33", kitsu_manga: "44" });
|
||||
const p = recs[1]!;
|
||||
if (p.kind !== "engagement") throw new Error();
|
||||
expect(p.engagement.progress).toEqual({ chapter: 12, volume: 2 });
|
||||
@@ -91,7 +91,7 @@ describe("mangabaka", () => {
|
||||
test("lookup searches series", async () => {
|
||||
const { h, ctx } = ctxFor({ [`GET ${B}/v1/series/search`]: search });
|
||||
const r = await plugin.lookup!(ctx, { title: "Delta", mediaType: "manga" });
|
||||
expect(r).toEqual([{ title: "Delta", mediaType: "manga", year: 2018, externalIds: { mangabaka: "5", anilist: "55" } }]);
|
||||
expect(r).toEqual([{ title: "Delta", mediaType: "manga", year: 2018, externalIds: { mangabaka: "5", anilist_manga: "55" } }]);
|
||||
expect(new URL(h.calls[0]!.url).searchParams.get("q")).toBe("Delta");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user