This commit is contained in:
@@ -17,6 +17,7 @@ const input = {
|
||||
|
||||
test('stores validated upload bytes before persisting image metadata', async () => {
|
||||
const stored = [];
|
||||
const jobs = [];
|
||||
const service = createInventoryImageService({
|
||||
imageStorage: {
|
||||
async put(value) { stored.push(value); },
|
||||
@@ -27,6 +28,9 @@ test('stores validated upload bytes before persisting image metadata', async ()
|
||||
return { id: 'image-1', ...image };
|
||||
},
|
||||
},
|
||||
imageDerivativeJobRepository: {
|
||||
async create(job) { jobs.push(job); },
|
||||
},
|
||||
});
|
||||
|
||||
const image = await service.upload(input);
|
||||
@@ -36,6 +40,11 @@ test('stores validated upload bytes before persisting image metadata', async ()
|
||||
assert.equal(image.id, 'image-1');
|
||||
assert.equal(image.processingStatus, 'PENDING');
|
||||
assert.equal('data' in image, false);
|
||||
assert.deepEqual(jobs, [{
|
||||
inventoryImageId: 'image-1',
|
||||
sourceKey: input.storageKey,
|
||||
status: 'PENDING',
|
||||
}]);
|
||||
});
|
||||
|
||||
test('removes stored bytes when metadata persistence fails', async () => {
|
||||
|
||||
Reference in New Issue
Block a user