Merge pull request #4812 from Snuffleupagus/more-api-unittests

Add more unit tests for the API
This commit is contained in:
Yury Delendik 2014-05-19 11:15:44 -05:00
commit b7d8296902
2 changed files with 19 additions and 1 deletions

View File

@ -449,7 +449,7 @@ var Catalog = (function CatalogClosure() {
},
get attachments() {
var xref = this.xref;
var attachments, nameTreeRef;
var attachments = null, nameTreeRef;
var obj = this.catDict.get('Names');
if (obj) {
nameTreeRef = obj.getRaw('EmbeddedFiles');

View File

@ -69,6 +69,18 @@ describe('api', function() {
0, 841.89, null] });
});
});
it('gets attachments', function() {
var promise = doc.getAttachments();
waitsForPromise(promise, function (data) {
expect(data).toEqual(null);
});
});
it('gets javascript', function() {
var promise = doc.getJavaScript();
waitsForPromise(promise, function (data) {
expect(data).toEqual([]);
});
});
it('gets outline', function() {
var promise = doc.getOutline();
waitsForPromise(promise, function(outline) {
@ -93,6 +105,12 @@ describe('api', function() {
expect(true).toEqual(true);
});
});
it('gets filesize in bytes', function() {
var promise = doc.getDownloadInfo();
waitsForPromise(promise, function (data) {
expect(data.length).toEqual(105779);
});
});
});
describe('Page', function() {
var resolvePromise;