-
-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathpassword.test.ts
More file actions
17 lines (15 loc) · 693 Bytes
/
password.test.ts
File metadata and controls
17 lines (15 loc) · 693 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { data } from '../helper/password-123456';
import { PDFParse, VerbosityLevel } from 'pdf-parse';
import { describe, expect, test } from 'vitest';
describe('load password protected pdf', async () => {
const buffer = await data.getBuffer();
const parser = new PDFParse({ data: buffer, password: '123456', verbosity: VerbosityLevel.WARNINGS });
const infoResult = await parser.getInfo();
const textResult = await parser.getText();
test('results be correct', () => {
expect(infoResult.total).toEqual(2);
expect(infoResult.infoData?.PDFFormatVersion).toEqual('1.7');
expect(textResult.total).toEqual(2);
expect(textResult.text).toContain('Welcome to Adobe Acrobat');
});
});