Files
smartpdf/test/test.ts

37 lines
1.1 KiB
TypeScript
Raw Normal View History

2018-10-06 13:25:45 +00:00
import { expect, tap } from '@pushrocks/tapbundle';
2018-10-06 17:35:26 +02:00
import * as smartpdf from '../ts/index';
2018-10-06 13:25:45 +00:00
let testSmartPdf: smartpdf.SmartPdf;
tap.test('should create a valid instance of smartpdf', async () => {
testSmartPdf = new smartpdf.SmartPdf();
expect(testSmartPdf).to.be.instanceof(smartpdf.SmartPdf);
2018-10-06 17:35:26 +02:00
});
2018-10-06 13:25:45 +00:00
2019-05-29 14:14:02 +02:00
tap.test('should start the instance', async () => {
await testSmartPdf.start();
});
2018-10-06 13:25:45 +00:00
tap.test('should create a pdf from html string', async () => {
await testSmartPdf.getPdfForHtmlString('hi');
});
2019-05-29 00:27:43 +02:00
tap.test('should create a pdf from website as A4', async () => {
2019-04-10 15:12:54 +02:00
await testSmartPdf.getPdfForWebsite('https://maintainedby.lossless.com');
2018-10-06 13:25:45 +00:00
});
2019-05-29 00:27:43 +02:00
tap.test('should create a pdf from website as single page PDF', async () => {
await testSmartPdf.getFullWebsiteAsSinglePdf('https://maintainedby.lossless.com');
});
2019-05-29 19:49:23 +02:00
tap.test('should create a valid PDFResult', async () => {
const pdfResult = await testSmartPdf.getFullWebsiteAsSinglePdf('https://maintainedby.lossless.com');
expect(pdfResult.buffer).to.be.instanceOf(Buffer);
});
2018-10-06 17:35:26 +02:00
tap.test('should be able to close properly', async () => {
2019-05-29 14:14:02 +02:00
await testSmartPdf.stop();
2018-10-06 17:35:26 +02:00
});
tap.start();