Merge pull request #11095 from timvandermeij/api-attachments-unit-test
Include a reduced, non-linked PDF file for the attachments API unit test
This commit is contained in:
commit
d64b49831d
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -250,6 +250,7 @@
|
|||||||
!bug1175962.pdf
|
!bug1175962.pdf
|
||||||
!bug1020226.pdf
|
!bug1020226.pdf
|
||||||
!issue9534_reduced.pdf
|
!issue9534_reduced.pdf
|
||||||
|
!attachment.pdf
|
||||||
!basicapi.pdf
|
!basicapi.pdf
|
||||||
!issue2884_reduced.pdf
|
!issue2884_reduced.pdf
|
||||||
!mixedfonts.pdf
|
!mixedfonts.pdf
|
||||||
|
BIN
test/pdfs/attachment.pdf
Normal file
BIN
test/pdfs/attachment.pdf
Normal file
Binary file not shown.
@ -692,18 +692,15 @@ describe('api', function() {
|
|||||||
}).catch(done.fail);
|
}).catch(done.fail);
|
||||||
});
|
});
|
||||||
it('gets attachments', function(done) {
|
it('gets attachments', function(done) {
|
||||||
if (isNodeJS()) { // The PDF file used is a linked test-case.
|
var loadingTask = getDocument(buildGetDocumentParams('attachment.pdf'));
|
||||||
pending('TODO: Use a non-linked test-case.');
|
|
||||||
}
|
|
||||||
var loadingTask = getDocument(buildGetDocumentParams('bug766138.pdf'));
|
|
||||||
var promise = loadingTask.promise.then(function (pdfDoc) {
|
var promise = loadingTask.promise.then(function (pdfDoc) {
|
||||||
return pdfDoc.getAttachments();
|
return pdfDoc.getAttachments();
|
||||||
});
|
});
|
||||||
promise.then(function (data) {
|
promise.then(function (data) {
|
||||||
var attachment = data['Press Quality.joboptions'];
|
var attachment = data['foo.txt'];
|
||||||
expect(attachment.filename).toEqual('Press Quality.joboptions');
|
expect(attachment.filename).toEqual('foo.txt');
|
||||||
expect(attachment.content instanceof Uint8Array).toBeTruthy();
|
expect(attachment.content).toEqual(
|
||||||
expect(attachment.content.length).toEqual(30098);
|
new Uint8Array([98, 97, 114, 32, 98, 97, 122, 32, 10]));
|
||||||
|
|
||||||
loadingTask.destroy().then(done);
|
loadingTask.destroy().then(done);
|
||||||
}).catch(done.fail);
|
}).catch(done.fail);
|
||||||
|
Loading…
Reference in New Issue
Block a user