Fix SCUM gift catalog visibility

This commit is contained in:
npc0-hue
2026-09-23 16:12:33 +08:00
parent e8ebf562c7
commit 7e0780ea51
4 changed files with 23 additions and 4 deletions
+9
View File
@@ -10,6 +10,15 @@ const pluginRoot = resolve(dirname(fileURLToPath(import.meta.url)), "../examples
const catalogSource = readFileSync(join(pluginRoot, "features/scum-catalog.ts"), "utf8");
describe("scum catalog icons", () => {
it("includes the backpack and military helmet entries users expect", () => {
const byCode = new Map(scumCatalogEntries.map((entry) => [entry.code, entry]));
expect(byCode.get("Improvised_Backpack_Big")).toMatchObject({ kind: "item" });
expect(byCode.get("Military_Backpack_01_01")).toMatchObject({ kind: "item" });
expect(byCode.get("Military_Helmet_01_01")).toMatchObject({ kind: "item" });
expect(byCode.get("Improvised_Backpack_Big")?.icon).toContain("backpacks/");
expect(byCode.get("Military_Helmet_01_01")?.icon).toContain("head armor/");
});
it("resolves icons on demand instead of importing each icon as its own module", () => {
expect(catalogSource).not.toContain("import.meta.glob");
expect(scumCatalogIconUrl("npcs/zombie11.webp")).toContain("zombie11.webp");
@@ -346,9 +346,13 @@ describe("SCUM plugin feature module", () => {
it("shows Chinese catalog names and searches through the translated name", () => {
const aloe = scumCatalogEntries.find((item) => item.code === "Aloe_Vera")!;
const vehicle = scumCatalogEntries.find((item) => item.code === "BPC_Laika")!;
const bigBackpack = scumCatalogEntries.find((item) => item.code === "Improvised_Backpack_Big")!;
const militaryHelmet = scumCatalogEntries.find((item) => item.code === "Military_Helmet_01_01")!;
expect(scumCatalogDisplayName(aloe)).toBe("芦荟");
expect(scumCatalogDisplayName(vehicle)).toBe("莱卡");
expect(scumCatalogSearchText(aloe)).toContain("芦荟");
expect(scumCatalogSearchText(bigBackpack)).toContain("大背包");
expect(scumCatalogSearchText(militaryHelmet)).toContain("军用头盔");
});
it("uses catalog spawn commands for mixed gift contents", async () => {