Use shorter code for failing a test in test/unit/api_spec.js
This commit is contained in:
parent
959ed3705b
commit
e812c6e7ac
@ -85,9 +85,7 @@ describe('api', function() {
|
|||||||
expect(data[1] instanceof PDFDocumentProxy).toEqual(true);
|
expect(data[1] instanceof PDFDocumentProxy).toEqual(true);
|
||||||
expect(loadingTask).toEqual(data[1].loadingTask);
|
expect(loadingTask).toEqual(data[1].loadingTask);
|
||||||
loadingTask.destroy().then(done);
|
loadingTask.destroy().then(done);
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
it('creates pdf doc from URL and aborts before worker initialized',
|
it('creates pdf doc from URL and aborts before worker initialized',
|
||||||
function(done) {
|
function(done) {
|
||||||
@ -112,9 +110,7 @@ describe('api', function() {
|
|||||||
destroyed.then(function (data) {
|
destroyed.then(function (data) {
|
||||||
expect(true).toEqual(true);
|
expect(true).toEqual(true);
|
||||||
done();
|
done();
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
it('creates pdf doc from typed array', function(done) {
|
it('creates pdf doc from typed array', function(done) {
|
||||||
var typedArrayPdf;
|
var typedArrayPdf;
|
||||||
@ -150,9 +146,7 @@ describe('api', function() {
|
|||||||
loadingTask.promise.then(function(data) {
|
loadingTask.promise.then(function(data) {
|
||||||
expect(data instanceof PDFDocumentProxy).toEqual(true);
|
expect(data instanceof PDFDocumentProxy).toEqual(true);
|
||||||
loadingTask.destroy().then(done);
|
loadingTask.destroy().then(done);
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
it('creates pdf doc from invalid PDF file', function(done) {
|
it('creates pdf doc from invalid PDF file', function(done) {
|
||||||
// A severely corrupt PDF file (even Adobe Reader fails to open it).
|
// A severely corrupt PDF file (even Adobe Reader fails to open it).
|
||||||
@ -214,9 +208,7 @@ describe('api', function() {
|
|||||||
Promise.all(promises).then(function (data) {
|
Promise.all(promises).then(function (data) {
|
||||||
expect(data[2] instanceof PDFDocumentProxy).toEqual(true);
|
expect(data[2] instanceof PDFDocumentProxy).toEqual(true);
|
||||||
loadingTask.destroy().then(done);
|
loadingTask.destroy().then(done);
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
it('creates pdf doc from PDF file protected with only a user password',
|
it('creates pdf doc from PDF file protected with only a user password',
|
||||||
function (done) {
|
function (done) {
|
||||||
@ -258,9 +250,7 @@ describe('api', function() {
|
|||||||
});
|
});
|
||||||
Promise.all([result1, result2, result3]).then(function () {
|
Promise.all([result1, result2, result3]).then(function () {
|
||||||
done();
|
done();
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('creates pdf doc from password protected PDF file and aborts/throws ' +
|
it('creates pdf doc from password protected PDF file and aborts/throws ' +
|
||||||
@ -310,9 +300,7 @@ describe('api', function() {
|
|||||||
|
|
||||||
Promise.all([result1, result2]).then(function () {
|
Promise.all([result1, result2]).then(function () {
|
||||||
done();
|
done();
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -334,9 +322,7 @@ describe('api', function() {
|
|||||||
expect(!!worker.port).toEqual(false);
|
expect(!!worker.port).toEqual(false);
|
||||||
expect(worker.destroyed).toEqual(true);
|
expect(worker.destroyed).toEqual(true);
|
||||||
done();
|
done();
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
it('worker created or destroyed by getDocument', function (done) {
|
it('worker created or destroyed by getDocument', function (done) {
|
||||||
if (isNodeJS()) {
|
if (isNodeJS()) {
|
||||||
@ -358,9 +344,7 @@ describe('api', function() {
|
|||||||
expect(!!destroyedWorker).toEqual(false);
|
expect(!!destroyedWorker).toEqual(false);
|
||||||
expect(worker.destroyed).toEqual(true);
|
expect(worker.destroyed).toEqual(true);
|
||||||
done();
|
done();
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
it('worker created and can be used in getDocument', function (done) {
|
it('worker created and can be used in getDocument', function (done) {
|
||||||
if (isNodeJS()) {
|
if (isNodeJS()) {
|
||||||
@ -387,9 +371,7 @@ describe('api', function() {
|
|||||||
expect(worker.destroyed).toEqual(false);
|
expect(worker.destroyed).toEqual(false);
|
||||||
worker.destroy();
|
worker.destroy();
|
||||||
done();
|
done();
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
it('creates more than one worker', function (done) {
|
it('creates more than one worker', function (done) {
|
||||||
if (isNodeJS()) {
|
if (isNodeJS()) {
|
||||||
@ -409,9 +391,7 @@ describe('api', function() {
|
|||||||
worker2.destroy();
|
worker2.destroy();
|
||||||
worker3.destroy();
|
worker3.destroy();
|
||||||
done();
|
done();
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
it('gets current workerSrc', function() {
|
it('gets current workerSrc', function() {
|
||||||
if (isNodeJS()) {
|
if (isNodeJS()) {
|
||||||
@ -453,9 +433,7 @@ describe('api', function() {
|
|||||||
expect(data instanceof PDFPageProxy).toEqual(true);
|
expect(data instanceof PDFPageProxy).toEqual(true);
|
||||||
expect(data.pageIndex).toEqual(0);
|
expect(data.pageIndex).toEqual(0);
|
||||||
done();
|
done();
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
it('gets non-existent page', function(done) {
|
it('gets non-existent page', function(done) {
|
||||||
var outOfRangePromise = doc.getPage(100);
|
var outOfRangePromise = doc.getPage(100);
|
||||||
@ -481,9 +459,7 @@ describe('api', function() {
|
|||||||
Promise.all([outOfRangePromise, nonIntegerPromise, nonNumberPromise]).
|
Promise.all([outOfRangePromise, nonIntegerPromise, nonNumberPromise]).
|
||||||
then(function () {
|
then(function () {
|
||||||
done();
|
done();
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
it('gets page index', function(done) {
|
it('gets page index', function(done) {
|
||||||
// reference to second page
|
// reference to second page
|
||||||
@ -492,9 +468,7 @@ describe('api', function() {
|
|||||||
promise.then(function(pageIndex) {
|
promise.then(function(pageIndex) {
|
||||||
expect(pageIndex).toEqual(1);
|
expect(pageIndex).toEqual(1);
|
||||||
done();
|
done();
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
it('gets invalid page index', function (done) {
|
it('gets invalid page index', function (done) {
|
||||||
var ref = { num: 3, gen: 0, }; // Reference to a font dictionary.
|
var ref = { num: 3, gen: 0, }; // Reference to a font dictionary.
|
||||||
@ -514,9 +488,7 @@ describe('api', function() {
|
|||||||
chapter1: [{ gen: 0, num: 17, }, { name: 'XYZ', }, 0, 841.89, null],
|
chapter1: [{ gen: 0, num: 17, }, { name: 'XYZ', }, 0, 841.89, null],
|
||||||
});
|
});
|
||||||
done();
|
done();
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
it('gets a destination, from /Dests dictionary', function(done) {
|
it('gets a destination, from /Dests dictionary', function(done) {
|
||||||
var promise = doc.getDestination('chapter1');
|
var promise = doc.getDestination('chapter1');
|
||||||
@ -524,9 +496,7 @@ describe('api', function() {
|
|||||||
expect(data).toEqual([{ gen: 0, num: 17, }, { name: 'XYZ', },
|
expect(data).toEqual([{ gen: 0, num: 17, }, { name: 'XYZ', },
|
||||||
0, 841.89, null]);
|
0, 841.89, null]);
|
||||||
done();
|
done();
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
it('gets a non-existent destination, from /Dests dictionary',
|
it('gets a non-existent destination, from /Dests dictionary',
|
||||||
function(done) {
|
function(done) {
|
||||||
@ -534,9 +504,7 @@ describe('api', function() {
|
|||||||
promise.then(function(data) {
|
promise.then(function(data) {
|
||||||
expect(data).toEqual(null);
|
expect(data).toEqual(null);
|
||||||
done();
|
done();
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('gets destinations, from /Names (NameTree) dictionary', function(done) {
|
it('gets destinations, from /Names (NameTree) dictionary', function(done) {
|
||||||
@ -551,9 +519,7 @@ describe('api', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
loadingTask.destroy().then(done);
|
loadingTask.destroy().then(done);
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
it('gets a destination, from /Names (NameTree) dictionary', function(done) {
|
it('gets a destination, from /Names (NameTree) dictionary', function(done) {
|
||||||
var loadingTask = getDocument(buildGetDocumentParams('issue6204.pdf'));
|
var loadingTask = getDocument(buildGetDocumentParams('issue6204.pdf'));
|
||||||
@ -565,9 +531,7 @@ describe('api', function() {
|
|||||||
0, 375, null]);
|
0, 375, null]);
|
||||||
|
|
||||||
loadingTask.destroy().then(done);
|
loadingTask.destroy().then(done);
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
it('gets a non-existent destination, from /Names (NameTree) dictionary',
|
it('gets a non-existent destination, from /Names (NameTree) dictionary',
|
||||||
function(done) {
|
function(done) {
|
||||||
@ -579,9 +543,7 @@ describe('api', function() {
|
|||||||
expect(destination).toEqual(null);
|
expect(destination).toEqual(null);
|
||||||
|
|
||||||
loadingTask.destroy().then(done);
|
loadingTask.destroy().then(done);
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('gets non-string destination', function(done) {
|
it('gets non-string destination', function(done) {
|
||||||
@ -615,9 +577,7 @@ describe('api', function() {
|
|||||||
promise.then(function (data) {
|
promise.then(function (data) {
|
||||||
expect(data).toEqual(null);
|
expect(data).toEqual(null);
|
||||||
done();
|
done();
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
it('gets page labels', function (done) {
|
it('gets page labels', function (done) {
|
||||||
// PageLabels with Roman/Arabic numerals.
|
// PageLabels with Roman/Arabic numerals.
|
||||||
@ -658,9 +618,7 @@ describe('api', function() {
|
|||||||
loadingTask2.destroy(),
|
loadingTask2.destroy(),
|
||||||
loadingTask3.destroy()
|
loadingTask3.destroy()
|
||||||
]).then(done);
|
]).then(done);
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('gets default page mode', function(done) {
|
it('gets default page mode', function(done) {
|
||||||
@ -672,17 +630,13 @@ describe('api', function() {
|
|||||||
expect(mode).toEqual('UseNone');
|
expect(mode).toEqual('UseNone');
|
||||||
|
|
||||||
loadingTask.destroy().then(done);
|
loadingTask.destroy().then(done);
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
it('gets non-default page mode', function(done) {
|
it('gets non-default page mode', function(done) {
|
||||||
doc.getPageMode().then(function(mode) {
|
doc.getPageMode().then(function(mode) {
|
||||||
expect(mode).toEqual('UseOutlines');
|
expect(mode).toEqual('UseOutlines');
|
||||||
done();
|
done();
|
||||||
}).catch(function(reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('gets non-existent attachments', function(done) {
|
it('gets non-existent attachments', function(done) {
|
||||||
@ -690,9 +644,7 @@ describe('api', function() {
|
|||||||
promise.then(function (data) {
|
promise.then(function (data) {
|
||||||
expect(data).toEqual(null);
|
expect(data).toEqual(null);
|
||||||
done();
|
done();
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
it('gets attachments', function(done) {
|
it('gets attachments', function(done) {
|
||||||
if (isNodeJS()) { // The PDF file used is a linked test-case.
|
if (isNodeJS()) { // The PDF file used is a linked test-case.
|
||||||
@ -709,9 +661,7 @@ describe('api', function() {
|
|||||||
expect(attachment.content.length).toEqual(30098);
|
expect(attachment.content.length).toEqual(30098);
|
||||||
|
|
||||||
loadingTask.destroy().then(done);
|
loadingTask.destroy().then(done);
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('gets javascript', function(done) {
|
it('gets javascript', function(done) {
|
||||||
@ -719,9 +669,7 @@ describe('api', function() {
|
|||||||
promise.then(function (data) {
|
promise.then(function (data) {
|
||||||
expect(data).toEqual(null);
|
expect(data).toEqual(null);
|
||||||
done();
|
done();
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
// Keep this in sync with the pattern in viewer.js. The pattern is used to
|
// Keep this in sync with the pattern in viewer.js. The pattern is used to
|
||||||
// detect whether or not to automatically start printing.
|
// detect whether or not to automatically start printing.
|
||||||
@ -737,9 +685,7 @@ describe('api', function() {
|
|||||||
expect(data).toEqual(['print({});']);
|
expect(data).toEqual(['print({});']);
|
||||||
expect(data[0]).toMatch(viewerPrintRegExp);
|
expect(data[0]).toMatch(viewerPrintRegExp);
|
||||||
loadingTask.destroy().then(done);
|
loadingTask.destroy().then(done);
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
it('gets javascript with printing instructions (JS action)',
|
it('gets javascript with printing instructions (JS action)',
|
||||||
function(done) {
|
function(done) {
|
||||||
@ -753,9 +699,7 @@ describe('api', function() {
|
|||||||
['this.print({bUI:true,bSilent:false,bShrinkToFit:true});']);
|
['this.print({bUI:true,bSilent:false,bShrinkToFit:true});']);
|
||||||
expect(data[0]).toMatch(viewerPrintRegExp);
|
expect(data[0]).toMatch(viewerPrintRegExp);
|
||||||
loadingTask.destroy().then(done);
|
loadingTask.destroy().then(done);
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
it('gets non-existent outline', function(done) {
|
it('gets non-existent outline', function(done) {
|
||||||
var loadingTask = getDocument(buildGetDocumentParams('tracemonkey.pdf'));
|
var loadingTask = getDocument(buildGetDocumentParams('tracemonkey.pdf'));
|
||||||
@ -767,9 +711,7 @@ describe('api', function() {
|
|||||||
expect(outline).toEqual(null);
|
expect(outline).toEqual(null);
|
||||||
|
|
||||||
loadingTask.destroy().then(done);
|
loadingTask.destroy().then(done);
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
it('gets outline', function(done) {
|
it('gets outline', function(done) {
|
||||||
var promise = doc.getOutline();
|
var promise = doc.getOutline();
|
||||||
@ -792,9 +734,7 @@ describe('api', function() {
|
|||||||
expect(outlineItem.items.length).toEqual(1);
|
expect(outlineItem.items.length).toEqual(1);
|
||||||
expect(outlineItem.items[0].title).toEqual('Paragraph 1.1');
|
expect(outlineItem.items[0].title).toEqual('Paragraph 1.1');
|
||||||
done();
|
done();
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
it('gets outline containing a url', function(done) {
|
it('gets outline containing a url', function(done) {
|
||||||
var loadingTask = getDocument(buildGetDocumentParams('issue3214.pdf'));
|
var loadingTask = getDocument(buildGetDocumentParams('issue3214.pdf'));
|
||||||
@ -819,9 +759,7 @@ describe('api', function() {
|
|||||||
|
|
||||||
loadingTask.destroy().then(done);
|
loadingTask.destroy().then(done);
|
||||||
});
|
});
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('gets non-existent permissions', function(done) {
|
it('gets non-existent permissions', function(done) {
|
||||||
@ -829,9 +767,7 @@ describe('api', function() {
|
|||||||
expect(permissions).toEqual(null);
|
expect(permissions).toEqual(null);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
}).catch(function(reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('gets permissions', function (done) {
|
it('gets permissions', function (done) {
|
||||||
@ -875,9 +811,7 @@ describe('api', function() {
|
|||||||
loadingTask1.destroy(),
|
loadingTask1.destroy(),
|
||||||
loadingTask2.destroy(),
|
loadingTask2.destroy(),
|
||||||
]).then(done);
|
]).then(done);
|
||||||
}).catch(function(reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('gets metadata', function(done) {
|
it('gets metadata', function(done) {
|
||||||
@ -895,9 +829,7 @@ describe('api', function() {
|
|||||||
|
|
||||||
expect(contentDispositionFilename).toEqual(null);
|
expect(contentDispositionFilename).toEqual(null);
|
||||||
done();
|
done();
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
it('gets data', function(done) {
|
it('gets data', function(done) {
|
||||||
var promise = doc.getData();
|
var promise = doc.getData();
|
||||||
@ -905,27 +837,21 @@ describe('api', function() {
|
|||||||
expect(data instanceof Uint8Array).toEqual(true);
|
expect(data instanceof Uint8Array).toEqual(true);
|
||||||
expect(data.length).toEqual(basicApiFileLength);
|
expect(data.length).toEqual(basicApiFileLength);
|
||||||
done();
|
done();
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
it('gets download info', function(done) {
|
it('gets download info', function(done) {
|
||||||
var promise = doc.getDownloadInfo();
|
var promise = doc.getDownloadInfo();
|
||||||
promise.then(function (data) {
|
promise.then(function (data) {
|
||||||
expect(data).toEqual({ length: basicApiFileLength, });
|
expect(data).toEqual({ length: basicApiFileLength, });
|
||||||
done();
|
done();
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
it('gets document stats', function(done) {
|
it('gets document stats', function(done) {
|
||||||
var promise = doc.getStats();
|
var promise = doc.getStats();
|
||||||
promise.then(function (stats) {
|
promise.then(function (stats) {
|
||||||
expect(stats).toEqual({ streamTypes: [], fontTypes: [], });
|
expect(stats).toEqual({ streamTypes: [], fontTypes: [], });
|
||||||
done();
|
done();
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checks that fingerprints are unique', function(done) {
|
it('checks that fingerprints are unique', function(done) {
|
||||||
@ -950,9 +876,7 @@ describe('api', function() {
|
|||||||
loadingTask1.destroy(),
|
loadingTask1.destroy(),
|
||||||
loadingTask2.destroy()
|
loadingTask2.destroy()
|
||||||
]).then(done);
|
]).then(done);
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Cross-origin', function() {
|
describe('Cross-origin', function() {
|
||||||
@ -1046,9 +970,7 @@ describe('api', function() {
|
|||||||
page = data;
|
page = data;
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(function(done) {
|
afterAll(function(done) {
|
||||||
@ -1108,9 +1030,7 @@ describe('api', function() {
|
|||||||
Promise.all([defaultPromise, displayPromise, printPromise]).then(
|
Promise.all([defaultPromise, displayPromise, printPromise]).then(
|
||||||
function () {
|
function () {
|
||||||
done();
|
done();
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('gets annotations containing relative URLs (bug 766086)',
|
it('gets annotations containing relative URLs (bug 766086)',
|
||||||
@ -1170,9 +1090,7 @@ describe('api', function() {
|
|||||||
docBaseUrlLoadingTask.destroy(),
|
docBaseUrlLoadingTask.destroy(),
|
||||||
invalidDocBaseUrlLoadingTask.destroy()
|
invalidDocBaseUrlLoadingTask.destroy()
|
||||||
]).then(done);
|
]).then(done);
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('gets text content', function (done) {
|
it('gets text content', function (done) {
|
||||||
@ -1194,9 +1112,7 @@ describe('api', function() {
|
|||||||
// A simple check that ensures the two `textContent` object match.
|
// A simple check that ensures the two `textContent` object match.
|
||||||
expect(JSON.stringify(data[0])).toEqual(JSON.stringify(data[1]));
|
expect(JSON.stringify(data[0])).toEqual(JSON.stringify(data[1]));
|
||||||
done();
|
done();
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
it('gets operator list', function(done) {
|
it('gets operator list', function(done) {
|
||||||
var promise = page.getOperatorList();
|
var promise = page.getOperatorList();
|
||||||
@ -1205,9 +1121,7 @@ describe('api', function() {
|
|||||||
expect(!!oplist.argsArray).toEqual(true);
|
expect(!!oplist.argsArray).toEqual(true);
|
||||||
expect(oplist.lastChunk).toEqual(true);
|
expect(oplist.lastChunk).toEqual(true);
|
||||||
done();
|
done();
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
it('gets operatorList with JPEG image (issue 4888)', function(done) {
|
it('gets operatorList with JPEG image (issue 4888)', function(done) {
|
||||||
let loadingTask = getDocument(buildGetDocumentParams('cmykjpeg.pdf'));
|
let loadingTask = getDocument(buildGetDocumentParams('cmykjpeg.pdf'));
|
||||||
@ -1224,9 +1138,7 @@ describe('api', function() {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
it('gets document stats after parsing page', function(done) {
|
it('gets document stats after parsing page', function(done) {
|
||||||
var promise = page.getOperatorList().then(function () {
|
var promise = page.getOperatorList().then(function () {
|
||||||
@ -1242,9 +1154,7 @@ describe('api', function() {
|
|||||||
expect(stats).toEqual({ streamTypes: expectedStreamTypes,
|
expect(stats).toEqual({ streamTypes: expectedStreamTypes,
|
||||||
fontTypes: expectedFontTypes, });
|
fontTypes: expectedFontTypes, });
|
||||||
done();
|
done();
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('gets page stats after parsing page, without `pdfBug` set',
|
it('gets page stats after parsing page, without `pdfBug` set',
|
||||||
@ -1478,9 +1388,7 @@ describe('api', function() {
|
|||||||
});
|
});
|
||||||
promiseDone.then(function() {
|
promiseDone.then(function() {
|
||||||
done();
|
done();
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('PDFDataRangeTransport', function () {
|
describe('PDFDataRangeTransport', function () {
|
||||||
@ -1537,9 +1445,7 @@ describe('api', function() {
|
|||||||
expect(page.rotate).toEqual(0);
|
expect(page.rotate).toEqual(0);
|
||||||
expect(fetches).toBeGreaterThan(2);
|
expect(fetches).toBeGreaterThan(2);
|
||||||
done();
|
done();
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
it('should fetch document info and page using range and streaming',
|
it('should fetch document info and page using range and streaming',
|
||||||
function (done) {
|
function (done) {
|
||||||
@ -1578,9 +1484,7 @@ describe('api', function() {
|
|||||||
expect(page.rotate).toEqual(0);
|
expect(page.rotate).toEqual(0);
|
||||||
expect(fetches).toEqual(1);
|
expect(fetches).toEqual(1);
|
||||||
done();
|
done();
|
||||||
}).catch(function (reason) {
|
}).catch(done.fail);
|
||||||
done.fail(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user