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
This commit is contained in:
13
test/test.ts
13
test/test.ts
@@ -39,8 +39,8 @@ tap.test('should create PDFs from HTML string', async () => {
|
||||
});
|
||||
|
||||
tap.test('should create PDFs from websites', async () => {
|
||||
const pdfA4 = await testSmartPdf.getPdfResultForWebsite('https://www.wikipedia.org');
|
||||
const pdfSingle = await testSmartPdf.getFullWebsiteAsSinglePdf('https://www.wikipedia.org');
|
||||
const pdfA4 = await testSmartPdf.getPdfResultForWebsite('https://example.com');
|
||||
const pdfSingle = await testSmartPdf.getFullWebsiteAsSinglePdf('https://example.com');
|
||||
expect(pdfA4.buffer).toBeInstanceOf(Buffer);
|
||||
expect(pdfSingle.buffer).toBeInstanceOf(Buffer);
|
||||
});
|
||||
@@ -82,6 +82,13 @@ 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 () => {
|
||||
const pdfResult = await testSmartPdf.getFullWebsiteAsSinglePdf('https://www.wikipedia.org');
|
||||
expect(pdfResult.buffer).toBeInstanceOf(Buffer);
|
||||
ensureDir('.nogit');
|
||||
fs.writeFileSync(path.join('.nogit', '3.pdf'), pdfResult.buffer as Buffer);
|
||||
});
|
||||
|
||||
tap.test('should create WebP preview images from PDF', async () => {
|
||||
const pdfObject = await testSmartPdf.readFileToPdfObject('.nogit/3.pdf');
|
||||
const webpPreviews = await testSmartPdf.convertPDFToWebpBytes(pdfObject.buffer);
|
||||
@@ -285,4 +292,4 @@ tap.test('should close the SmartPdf instance properly', async () => {
|
||||
await testSmartPdf.stop();
|
||||
});
|
||||
|
||||
tap.start();
|
||||
export default tap.start();
|
||||
Reference in New Issue
Block a user