Add unit test for |MissingPDFException|

This commit is contained in:
Jonas Jenwald 2014-09-07 17:39:49 +02:00
parent 6077e93275
commit 27a80f3b88

View File

@ -1,7 +1,7 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/* globals PDFJS, expect, it, describe, Promise, combineUrl, waitsFor, /* globals PDFJS, expect, it, describe, Promise, combineUrl, waitsFor,
isArray */ isArray, MissingPDFException */
'use strict'; 'use strict';
@ -79,6 +79,14 @@ describe('api', function() {
expect(true).toEqual(true); expect(true).toEqual(true);
}); });
}); });
it('creates pdf doc from non-existent URL', function() {
var nonExistentUrl = combineUrl(window.location.href,
'../pdfs/non-existent.pdf');
var promise = PDFJS.getDocument(nonExistentUrl);
waitsForPromiseRejected(promise, function(error) {
expect(error instanceof MissingPDFException).toEqual(true);
});
});
}); });
}); });
describe('PDFDocument', function() { describe('PDFDocument', function() {