Include a reduced, non-linked PDF file for the attachments API unit test

This commit is contained in:
Tim van der Meij 2019-08-24 19:57:35 +02:00
parent 56ae7a6690
commit 09df1ee0ce
No known key found for this signature in database
GPG Key ID: 8C3FD2925A5F2762
3 changed files with 6 additions and 8 deletions

View File

@ -250,6 +250,7 @@
!bug1175962.pdf
!bug1020226.pdf
!issue9534_reduced.pdf
!attachment.pdf
!basicapi.pdf
!issue2884_reduced.pdf
!mixedfonts.pdf

BIN
test/pdfs/attachment.pdf Normal file

Binary file not shown.

View File

@ -692,18 +692,15 @@ describe('api', function() {
}).catch(done.fail);
});
it('gets attachments', function(done) {
if (isNodeJS()) { // The PDF file used is a linked test-case.
pending('TODO: Use a non-linked test-case.');
}
var loadingTask = getDocument(buildGetDocumentParams('bug766138.pdf'));
var loadingTask = getDocument(buildGetDocumentParams('attachment.pdf'));
var promise = loadingTask.promise.then(function (pdfDoc) {
return pdfDoc.getAttachments();
});
promise.then(function (data) {
var attachment = data['Press Quality.joboptions'];
expect(attachment.filename).toEqual('Press Quality.joboptions');
expect(attachment.content instanceof Uint8Array).toBeTruthy();
expect(attachment.content.length).toEqual(30098);
var attachment = data['foo.txt'];
expect(attachment.filename).toEqual('foo.txt');
expect(attachment.content).toEqual(
new Uint8Array([98, 97, 114, 32, 98, 97, 122, 32, 10]));
loadingTask.destroy().then(done);
}).catch(done.fail);