feat: add gear and weapon renders
Validate and deploy production / validate (push) Successful in 21s
Validate and deploy staging / validate (push) Successful in 25s
Validate and deploy production / deploy (push) Successful in 1m17s
Validate and deploy staging / deploy (push) Successful in 35s

This commit is contained in:
jb
2026-07-31 22:39:00 -04:00
parent 3acc08c81d
commit aaf9e0ce97
10 changed files with 171 additions and 25 deletions
+16 -1
View File
@@ -1,4 +1,5 @@
import { beforeEach, describe, expect, it, vi } from 'vitest';
import sharp from 'sharp';
const { rmMock } = vi.hoisted(() => ({ rmMock: vi.fn() }));
@@ -8,7 +9,7 @@ vi.mock('node:fs/promises', async (importOriginal) => ({
}));
import { GAME_ICON_TYPES } from './game-data-icons';
import { ManagedImageDeletionError, deleteManagedImage } from './managed-images';
import { ManagedImageDeletionError, deleteManagedImage, processManagedImage } from './managed-images';
type Row = Record<string, unknown>;
@@ -137,3 +138,17 @@ describe('deleteManagedImage', () => {
expect(rmMock).not.toHaveBeenCalled();
});
});
describe('processManagedImage', () => {
it('center-crops game-data renders to 1000 pixel WebP squares without removing the background', async () => {
const input = await sharp({ create: { width: 1296, height: 1000, channels: 3, background: '#263238' } })
.png()
.toBuffer();
const result = await processManagedImage(new File([input], 'mask.png', { type: 'image/png' }), false, false, true);
const metadata = await sharp(result.output).metadata();
expect(metadata.format).toBe('webp');
expect(metadata.width).toBe(1000);
expect(metadata.height).toBe(1000);
});
});