u
This commit is contained in:
@@ -214,6 +214,30 @@ async function runTests() {
|
||||
assert.equal(smallThumbMetadata.format, 'heif');
|
||||
assert.equal(smallThumbMetadata.width, 40);
|
||||
assert.equal(smallThumbMetadata.height, 27);
|
||||
|
||||
const brand = await store.brand.create(googleAuthId, { name: 'Small Thumb Test Brand' });
|
||||
await store.brand.addImage(googleAuthId, brand.id, sampleImage);
|
||||
const listedBrands = await store.brand.list(googleAuthId, { offset: 0, limit: 100 });
|
||||
const listedBrand = listedBrands.brands.find((item) => item.id === brand.id);
|
||||
assert(listedBrand, 'Brand list should include the created brand');
|
||||
assert.equal(listedBrand.pics.length, 1);
|
||||
assert(!('smallThumbW' in listedBrand.pics[0]), 'Small-thumb fields should be omitted by default');
|
||||
|
||||
const listedBrandsWithSmallThumbs = await store.brand.list(googleAuthId, {
|
||||
offset: 0,
|
||||
limit: 100,
|
||||
includeSmallThumbs: true,
|
||||
});
|
||||
const listedBrandWithSmallThumbs = listedBrandsWithSmallThumbs.brands.find((item) => item.id === brand.id);
|
||||
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(typeof listedPic.smallThumbBinary, 'string');
|
||||
const listedSmallThumb = Buffer.from(listedPic.smallThumbBinary, 'base64');
|
||||
assert.deepEqual(listedSmallThumb, smallThumbRow.smallthumbbinary);
|
||||
|
||||
console.log('Article pic added with hash:', fullHash);
|
||||
|
||||
const fullPath = join(storageDir, 'fullbinary', fullHash + '.avif');
|
||||
|
||||
Reference in New Issue
Block a user