fix: inspect uploaded image dimensions on the server
Quality / test (push) Canceled after 0s

This commit is contained in:
2026-09-11 00:35:07 -04:00
parent cce395baf6
commit e6510c0317
11 changed files with 170 additions and 13 deletions
@@ -19,6 +19,7 @@ test('stores validated upload bytes before persisting image metadata', async ()
const stored = [];
const jobs = [];
const service = createInventoryImageService({
imageInspector: { async readMetadata() { return { width: 2, height: 3, mimeType: 'image/jpeg' }; }, async validateDecoding() {} },
imageStorage: {
async put(value) { stored.push(value); },
async delete() {},
@@ -38,6 +39,9 @@ test('stores validated upload bytes before persisting image metadata', async ()
assert.equal(stored.length, 1);
assert.deepEqual(stored[0], { key: input.storageKey, data: input.data });
assert.equal(image.id, 'image-1');
assert.equal(image.width, 2);
assert.equal(image.height, 3);
assert.equal(image.fileSize, input.data.length);
assert.equal(image.processingStatus, 'PENDING');
assert.equal('data' in image, false);
assert.deepEqual(jobs, [{
@@ -50,6 +54,7 @@ test('stores validated upload bytes before persisting image metadata', async ()
test('removes stored bytes when metadata persistence fails', async () => {
const deleted = [];
const service = createInventoryImageService({
imageInspector: { async readMetadata() { return { width: 2, height: 3, mimeType: 'image/jpeg' }; }, async validateDecoding() {} },
imageStorage: {
async put() {},
async delete(key) { deleted.push(key); },