fix(catalog): resolve namespaced Nitro frames and empty scale declarations

This commit is contained in:
Simo committed 2026-09-05 17:45:42 +02:00
1 parent cd75361b9f
commit dcb5f46eed
4 files changed
+77 -7

No files matched your search

+34
View File
@@ -177,3 +177,37 @@ it("unrotates atlas artwork before generating the smaller frame", async () => {
).metadata();
expect([size.width, size.height]).toEqual([3, 1]);
});
it("fills an empty scale declaration and retains namespaced frame naming", async () => {
const m = metadata();
const originalFrames = m.spritesheet.frames;
const source = createNitroBundle(
{
...m,
visualizations: [
{ size: 32, layerCount: 1, angle: 45, directions: { 0: {}, 2: {} } },
...m.visualizations,
],
spritesheet: {
...m.spritesheet,
frames: { chair_chair_64_a_0_0: originalFrames.chair_64_a_0_0 },
},
},
await sharp({
create: { width: 6, height: 8, channels: 4, background: "#ff0000" },
})
.png()
.toBuffer(),
"chair",
);
const result = parseNitroBundle((await generateScale32(source)).bundle);
expect(
(result.json.visualizations as { size: number }[]).filter(
(v) => v.size === 32,
),
).toHaveLength(1);
expect(
(result.json.spritesheet as { frames: Record<string, unknown> }).frames
.chair_chair_32_a_0_0,
).toBeDefined();
});