diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index a572e3f7d..6c76b3302 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -250,6 +250,7 @@ !bug1175962.pdf !bug1020226.pdf !issue9534_reduced.pdf +!attachment.pdf !basicapi.pdf !issue2884_reduced.pdf !mixedfonts.pdf diff --git a/test/pdfs/attachment.pdf b/test/pdfs/attachment.pdf new file mode 100644 index 000000000..6aaeab1ca Binary files /dev/null and b/test/pdfs/attachment.pdf differ diff --git a/test/unit/api_spec.js b/test/unit/api_spec.js index 2a2c18de2..c42e943ad 100644 --- a/test/unit/api_spec.js +++ b/test/unit/api_spec.js @@ -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);