Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-factor the PDFDataRangeTransport unit-tests and enable them in Node.js/Travis #10558

Merged

Conversation

Snuffleupagus
Copy link
Collaborator

There doesn't appear to be any particular reason for only running these unit-tests in browsers, since the PDFDataRangeTransport functionality itself should be back-end agnostic.

…tor `NodeFileReaderFactory` to be asynchronous

This allows simplification of the 'creates pdf doc from URL and aborts loading after worker initialized' API unit-test.

Note that the `DOMFileReaderFactory` uses the Fetch API, for simplicity, since it should be available in all browsers where we're running tests.
…ode.js/Travis

There doesn't appear to be any particular reason for only running these unit-tests in browsers, since the `PDFDataRangeTransport` functionality itself should be back-end agnostic.
@Snuffleupagus
Copy link
Collaborator Author

/botio unittest

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_unittest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.67.70.0:8877/327d8bff7a44e5e/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_unittest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.215.176.217:8877/6f3a1e6e532fc0b/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/327d8bff7a44e5e/output.txt

Total script time: 2.84 mins

  • Unit Tests: Passed

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://54.215.176.217:8877/6f3a1e6e532fc0b/output.txt

Total script time: 5.33 mins

  • Unit Tests: Passed

@timvandermeij timvandermeij merged commit ff74a66 into mozilla:master Feb 17, 2019
@timvandermeij
Copy link
Contributor

Thank you for doing this!

@Snuffleupagus Snuffleupagus deleted the PDFDataRangeTransport-tests branch February 17, 2019 16:05
@Snuffleupagus
Copy link
Collaborator Author

Snuffleupagus commented Feb 17, 2019

Thanks for the very quick review!

I believe that we're now running all the possible unit-tests in Node.js/Travis, with the sole exception of

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 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);
loadingTask.destroy().then(done);
}).catch(done.fail);
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants