Remap occupied furniture IDs during Catalog Studio imports
CI / check (push) Successful in 1m39s
CI / deploy (push) Successful in 1m19s
CI / e2e (push) Successful in 21s

This commit is contained in:
Simo committed 2026-09-05 13:51:29 +02:00
1 parent 9f791ba284
commit 9dc6b8a261
6 files changed
+206 -9

No files matched your search

@@ -118,3 +118,49 @@ describe("completion of existing furniture", () => {
expect(mocks.append).not.toHaveBeenCalled();
});
});
it("imports recycler_kintsugiB with an allocated ID throughout SQL and furnidata", async () => {
vi.clearAllMocks();
const selections = [[], [{ itemName: "recycler_kintsugi" }]];
mocks.select.mockImplementation(() => ({
from: () => ({ where: () => ({ limit: async () => selections.shift() }) }),
}));
mocks.conflict.mockResolvedValue(null);
mocks.stat.mockResolvedValue({ size: 256 });
mocks.build.mockImplementation((value) => value);
mocks.execute.mockImplementation(async (query) => {
const { sql, params } = dialect.sqlToQuery(query);
if (sql.includes("MAX(")) return [[{ maximum: 2000037257 }], []];
if (sql.includes("SELECT item_name"))
return [
params[0] === 16940 ? [{ item_name: "recycler_kintsugi" }] : [],
[],
];
if (sql.includes("SELECT id, page_id"))
return [[{ id: 123, page_id: "15" }], []];
return [[], []];
});
const result = await importSingleFurni({
...input,
id: 16940,
classname: "recycler_kintsugiB",
});
expect(result.ok).toBe(true);
expect(result.itemId).toBe(2000037258);
expect(mocks.build).toHaveBeenCalledWith(
expect.objectContaining({
id: 2000037258,
spriteId: 2000037258,
classname: "recycler_kintsugiB",
}),
);
expect(
queries()
.find((q) => q.sql.includes("INSERT INTO items_base"))
?.params.slice(0, 2),
).toEqual([2000037258, 2000037258]);
expect(
queries().find((q) => q.sql.includes("SELECT id, page_id"))?.params,
).toContain("2000037258");
expect(result.warnings.join(" ")).toContain("16940");
});