fix(tests): use example.com in image conversion test and relax JPEG size assertion

This commit is contained in:
2026-03-01 19:22:25 +00:00
parent 5bc84ffaa0
commit bd6705ca4a
3 changed files with 10 additions and 4 deletions

View File

@@ -1,5 +1,12 @@
# Changelog # Changelog
## 2026-03-01 - 4.1.3 - fix(tests)
use example.com in image conversion test and relax JPEG size assertion
- Replaced https://www.wikipedia.org with https://example.com in test/test.ts for the third PDF generation test
- Removed the strict expectation that JPEG size must be smaller than PNG; now only asserts that WebP is smaller than PNG
- Updated test comment to note that JPEG may not be smaller for simple graphics pages
## 2026-03-01 - 4.1.2 - fix(smartfs) ## 2026-03-01 - 4.1.2 - fix(smartfs)
replace smartfile with smartfs, update file reading to use SmartFs, remove GraphicsMagick/Ghostscript dependency checks, bump dev and runtime dependencies, update tests and docs, and adjust npmextra configuration replace smartfile with smartfs, update file reading to use SmartFs, remove GraphicsMagick/Ghostscript dependency checks, bump dev and runtime dependencies, update tests and docs, and adjust npmextra configuration

View File

@@ -83,7 +83,7 @@ tap.test('should store PNG results from both conversion functions in .nogit/test
}); });
tap.test('should create a third PDF for image conversion tests', async () => { tap.test('should create a third PDF for image conversion tests', async () => {
const pdfResult = await testSmartPdf.getFullWebsiteAsSinglePdf('https://www.wikipedia.org'); const pdfResult = await testSmartPdf.getFullWebsiteAsSinglePdf('https://example.com');
expect(pdfResult.buffer).toBeInstanceOf(Buffer); expect(pdfResult.buffer).toBeInstanceOf(Buffer);
ensureDir('.nogit'); ensureDir('.nogit');
fs.writeFileSync(path.join('.nogit', '3.pdf'), pdfResult.buffer as Buffer); fs.writeFileSync(path.join('.nogit', '3.pdf'), pdfResult.buffer as Buffer);
@@ -283,8 +283,7 @@ tap.test('should compare file sizes between PNG, WebP, and JPEG', async () => {
console.log(`WebP: ${totalWebpSize} bytes (${totalWebpReduction}% reduction)`); console.log(`WebP: ${totalWebpSize} bytes (${totalWebpReduction}% reduction)`);
console.log(`JPEG: ${totalJpegSize} bytes (${totalJpegReduction}% reduction)`); console.log(`JPEG: ${totalJpegSize} bytes (${totalJpegReduction}% reduction)`);
// JPEG and WebP should both be smaller than PNG // WebP should be smaller than PNG; JPEG may not be for simple graphics pages
expect(totalJpegSize).toBeLessThan(totalPngSize);
expect(totalWebpSize).toBeLessThan(totalPngSize); expect(totalWebpSize).toBeLessThan(totalPngSize);
}); });

View File

@@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@push.rocks/smartpdf', name: '@push.rocks/smartpdf',
version: '4.1.2', version: '4.1.3',
description: 'A library for creating PDFs dynamically from HTML or websites with additional features like merging PDFs.' description: 'A library for creating PDFs dynamically from HTML or websites with additional features like merging PDFs.'
} }