-
-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathurl.test.ts
More file actions
26 lines (24 loc) · 1.03 KB
/
url.test.ts
File metadata and controls
26 lines (24 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { PDFParse } from 'pdf-parse';
import { describe, expect, test } from 'vitest';
describe('test-load url string', () => {
test('results be correct', { timeout: 15000 }, async () => {
const parser = new PDFParse({ url: 'https://bitcoin.org/bitcoin.pdf' });
const infoResult = await parser.getInfo();
const textResult = await parser.getText();
expect(infoResult.total).toEqual(9);
expect(infoResult.infoData?.PDFFormatVersion).toEqual('1.4');
expect(textResult.total).toEqual(9);
expect(textResult.text).toContain('Bitcoin');
});
});
describe('test-load url object', () => {
test('results be correct', { timeout: 15000 }, async () => {
const parser = new PDFParse({ url: new URL('https://mehmet-kozan.github.io/pdf-parse/pdf/bitcoin.pdf') });
const infoResult = await parser.getInfo();
const textResult = await parser.getText();
expect(infoResult.total).toEqual(9);
expect(infoResult.infoData?.PDFFormatVersion).toEqual('1.4');
expect(textResult.total).toEqual(9);
expect(textResult.text).toContain('Bitcoin');
});
});