57 lines
1.2 KiB
TypeScript
57 lines
1.2 KiB
TypeScript
// @vitest-environment node
|
|
import { describe, expect, it, vi } from "vitest";
|
|
|
|
vi.mock("@/lib/prisma", () => ({
|
|
prisma: {},
|
|
}));
|
|
|
|
vi.mock("@/lib/services/furni-data", () => ({
|
|
appendFurniEntry: vi.fn(),
|
|
buildFurniEntry: vi.fn(),
|
|
removeFurniEntry: vi.fn(),
|
|
}));
|
|
|
|
vi.mock("@/lib/services/habbo-furnidata-cache", () => ({
|
|
lookupHabboIt: vi.fn(),
|
|
}));
|
|
|
|
vi.mock("@/lib/services/import/core/download", () => ({
|
|
downloadFile: vi.fn(),
|
|
validatePngBytes: vi.fn(),
|
|
validateSwfBytes: vi.fn(),
|
|
}));
|
|
|
|
vi.mock("@/lib/services/swf-to-nitro", () => ({
|
|
convertSwfToNitro: vi.fn(),
|
|
extractIconFromSwf: vi.fn(),
|
|
}));
|
|
|
|
import { buildItemsBaseEnrichmentUpdate } from "./furni-import";
|
|
|
|
describe("buildItemsBaseEnrichmentUpdate", () => {
|
|
it("only updates columns present in the live Arcturus items_base schema", () => {
|
|
const update = buildItemsBaseEnrichmentUpdate({
|
|
id: 123,
|
|
dims: { x: 2, y: 3, z: 1.5 },
|
|
cansiton: true,
|
|
canlayon: false,
|
|
canstandon: true,
|
|
allowStack: "1",
|
|
interactionType: "default",
|
|
});
|
|
|
|
expect(update.sql).not.toContain("specialtype");
|
|
expect(update.values).toEqual([
|
|
2,
|
|
3,
|
|
1.5,
|
|
"1",
|
|
"0",
|
|
"1",
|
|
"1",
|
|
"default",
|
|
123,
|
|
]);
|
|
});
|
|
});
|