u
This commit is contained in:
@@ -215,18 +215,18 @@ async function runTests() {
|
||||
|
||||
const picResult = await store.article.addImage(googleAuthId, article.sku, sampleImage);
|
||||
const fullHash = picResult.fullHash;
|
||||
assert.equal(picResult.smallThumb.w, 40);
|
||||
assert.equal(picResult.smallThumb.h, 27);
|
||||
assert.equal(picResult.smallThumb.w, 32);
|
||||
assert.equal(picResult.smallThumb.h, 21);
|
||||
const smallThumbRow = provider.db.prepare(
|
||||
'SELECT smallthumbw, smallthumbh, smallthumbbinary FROM pic WHERE hash = ?',
|
||||
).get(fullHash);
|
||||
assert.equal(smallThumbRow.smallthumbw, 40);
|
||||
assert.equal(smallThumbRow.smallthumbh, 27);
|
||||
assert.equal(smallThumbRow.smallthumbw, 32);
|
||||
assert.equal(smallThumbRow.smallthumbh, 21);
|
||||
assert(Buffer.isBuffer(smallThumbRow.smallthumbbinary), 'Small thumb AVIF must be stored in the pic row');
|
||||
const smallThumbMetadata = await sharp(smallThumbRow.smallthumbbinary).metadata();
|
||||
assert.equal(smallThumbMetadata.format, 'heif');
|
||||
assert.equal(smallThumbMetadata.width, 40);
|
||||
assert.equal(smallThumbMetadata.height, 27);
|
||||
assert.equal(smallThumbMetadata.width, 32);
|
||||
assert.equal(smallThumbMetadata.height, 21);
|
||||
|
||||
const brand = await store.brand.create(googleAuthId, { name: 'Small Thumb Test Brand' });
|
||||
await store.brand.addImage(googleAuthId, brand.id, sampleImage);
|
||||
@@ -245,8 +245,8 @@ async function runTests() {
|
||||
assert(listedBrandWithSmallThumbs, 'Brand list with thumbnails should include the created brand');
|
||||
assert.equal(listedBrandWithSmallThumbs.pics.length, 1);
|
||||
const listedPic = listedBrandWithSmallThumbs.pics[0];
|
||||
assert.equal(listedPic.smallThumbW, 40);
|
||||
assert.equal(listedPic.smallThumbH, 27);
|
||||
assert.equal(listedPic.smallThumbW, 32);
|
||||
assert.equal(listedPic.smallThumbH, 21);
|
||||
assert.equal(typeof listedPic.smallThumbBinary, 'string');
|
||||
const listedSmallThumb = Buffer.from(listedPic.smallThumbBinary, 'base64');
|
||||
assert.deepEqual(listedSmallThumb, smallThumbRow.smallthumbbinary);
|
||||
|
||||
Reference in New Issue
Block a user