mirror of
https://github.com/foliojs/pdfkit.git
synced 2025-12-08 20:15:54 +00:00
37 lines
813 B
JavaScript
37 lines
813 B
JavaScript
import PDFDocument from '../../lib/document';
|
|
import PDFSecurity from '../../lib/security';
|
|
import { logData } from './helpers';
|
|
|
|
// manual mock for PDFSecurity to ensure stored id will be the same accross different systems
|
|
PDFSecurity.generateFileID = () => {
|
|
return new Buffer('mocked-pdf-id');
|
|
};
|
|
|
|
describe('Annotations', () => {
|
|
let document;
|
|
|
|
beforeEach(() => {
|
|
document = new PDFDocument({
|
|
info: { CreationDate: new Date(Date.UTC(2018, 1, 1)) }
|
|
});
|
|
});
|
|
|
|
describe('link', () => {
|
|
test('using page index', () => {
|
|
document.addPage();
|
|
|
|
const docData = logData(document);
|
|
|
|
document.text('Go To First Page', { link: 0 });
|
|
|
|
expect(docData).toContainChunk([
|
|
`11 0 obj`,
|
|
`<<
|
|
/S /GoTo
|
|
/D [7 0 R /XYZ null null null]
|
|
>>`
|
|
]);
|
|
});
|
|
});
|
|
});
|