u
This commit is contained in:
@@ -28,7 +28,7 @@ async function runTests() {
|
||||
assert(existsSync(join(storageDir, 'fullbinary')), 'fullbinary dir should exist');
|
||||
assert(existsSync(join(storageDir, 'thumbbinary')), 'thumbbinary dir should exist');
|
||||
|
||||
// Verify sqlite tables do NOT contain blob columns
|
||||
// Large file and image blobs stay on disk; the 40px small-thumb stays inline in pic.
|
||||
const fileTableInfo = provider.db.pragma('table_info("file")');
|
||||
const fileColNames = fileTableInfo.map((c) => c.name);
|
||||
console.log('file table columns:', fileColNames);
|
||||
@@ -40,6 +40,9 @@ async function runTests() {
|
||||
console.log('pic table columns:', picColNames);
|
||||
assert(!picColNames.includes('fullbinary'), 'pic table should NOT have fullbinary column');
|
||||
assert(!picColNames.includes('thumbbinary'), 'pic table should NOT have thumbbinary column');
|
||||
assert(picColNames.includes('smallthumbw'), 'pic table should have smallthumbw column');
|
||||
assert(picColNames.includes('smallthumbh'), 'pic table should have smallthumbh column');
|
||||
assert(picColNames.includes('smallthumbbinary'), 'pic table should have smallthumbbinary column');
|
||||
|
||||
// Setup base data: google_auth, company, unit, article, manifest
|
||||
const googleAuthId = await store.google_auth.add('test@example.com');
|
||||
@@ -199,6 +202,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);
|
||||
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(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);
|
||||
console.log('Article pic added with hash:', fullHash);
|
||||
|
||||
const fullPath = join(storageDir, 'fullbinary', fullHash + '.avif');
|
||||
|
||||
Reference in New Issue
Block a user