Merge pull request #6562 from Snuffleupagus/pr-5124-unit-test
Improved `get fingerprint` unit-tests (PR 5124)
This commit is contained in:
commit
aae82ec4c5
@ -220,7 +220,9 @@ describe('api', function() {
|
|||||||
expect(doc.numPages).toEqual(3);
|
expect(doc.numPages).toEqual(3);
|
||||||
});
|
});
|
||||||
it('gets fingerprint', function() {
|
it('gets fingerprint', function() {
|
||||||
expect(typeof doc.fingerprint).toEqual('string');
|
var fingerprint = doc.fingerprint;
|
||||||
|
expect(typeof fingerprint).toEqual('string');
|
||||||
|
expect(fingerprint.length > 0).toEqual(true);
|
||||||
});
|
});
|
||||||
it('gets page', function() {
|
it('gets page', function() {
|
||||||
var promise = doc.getPage(1);
|
var promise = doc.getPage(1);
|
||||||
@ -339,6 +341,28 @@ describe('api', function() {
|
|||||||
expect(stats).toEqual({ streamTypes: [], fontTypes: [] });
|
expect(stats).toEqual({ streamTypes: [], fontTypes: [] });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('checks that fingerprints are unique', function() {
|
||||||
|
var url1 = combineUrl(window.location.href, '../pdfs/issue4436r.pdf');
|
||||||
|
var loadingTask1 = PDFJS.getDocument(url1);
|
||||||
|
|
||||||
|
var url2 = combineUrl(window.location.href, '../pdfs/issue4575.pdf');
|
||||||
|
var loadingTask2 = PDFJS.getDocument(url2);
|
||||||
|
|
||||||
|
var promises = [loadingTask1.promise,
|
||||||
|
loadingTask2.promise];
|
||||||
|
waitsForPromiseResolved(Promise.all(promises), function (data) {
|
||||||
|
var fingerprint1 = data[0].fingerprint;
|
||||||
|
expect(typeof fingerprint1).toEqual('string');
|
||||||
|
expect(fingerprint1.length > 0).toEqual(true);
|
||||||
|
|
||||||
|
var fingerprint2 = data[1].fingerprint;
|
||||||
|
expect(typeof fingerprint2).toEqual('string');
|
||||||
|
expect(fingerprint2.length > 0).toEqual(true);
|
||||||
|
|
||||||
|
expect(fingerprint1).not.toEqual(fingerprint2);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
describe('Page', function() {
|
describe('Page', function() {
|
||||||
var resolvePromise;
|
var resolvePromise;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user