feat(catalog): queue furniture imports with history and matching file attachments
This commit is contained in:
1 parent
775d14f861
commit
2619bec165
16 files changed
+1016
-232
No files matched your search
@@ -0,0 +1,33 @@
|
||||
import { expect, it } from "vitest";
|
||||
import { validateFurnitureAttachment } from "./furni-attachment";
|
||||
import { createNitroBundle, encodePng } from "./swf/nitro-builder";
|
||||
|
||||
const png = encodePng(1, 1, Buffer.from([1, 2, 3, 255]));
|
||||
it("accepts the matching bundle including color variants sharing a library", () => {
|
||||
const buffer = createNitroBundle({ name: "chair" }, png, "chair");
|
||||
expect(validateFurnitureAttachment(buffer, "chair*2")).toBe(buffer);
|
||||
});
|
||||
it("rejects a similarly named furniture bundle", () => {
|
||||
expect(() =>
|
||||
validateFurnitureAttachment(
|
||||
createNitroBundle({ name: "china_light" }, png, "china_light"),
|
||||
"nft_china_light",
|
||||
),
|
||||
).toThrow("does not belong");
|
||||
});
|
||||
it("rejects a renamed JSON entry with mismatching metadata", () => {
|
||||
expect(() =>
|
||||
validateFurnitureAttachment(
|
||||
createNitroBundle({ name: "china_light" }, png, "nft_china_light"),
|
||||
"nft_china_light",
|
||||
),
|
||||
).toThrow("does not belong");
|
||||
});
|
||||
it("rejects missing texture data", () => {
|
||||
expect(() =>
|
||||
validateFurnitureAttachment(
|
||||
createNitroBundle({ name: "chair" }, Buffer.from("not png"), "chair"),
|
||||
"chair",
|
||||
),
|
||||
).toThrow("not a PNG");
|
||||
});
|
||||
Reference in new issue
Block a user