Remove redundant done-callback functions from unit-tests which are async

For unit-tests which are asynchronous, using a `done`-callback is redundant and future Jasmine versions will stop supporting that pattern.
This commit is contained in:
Jonas Jenwald 2021-03-21 11:33:39 +01:00
parent 4814e23310
commit eeda2215d7
2 changed files with 51 additions and 61 deletions

View File

@ -79,7 +79,7 @@ describe("annotation", function () {
let pdfManagerMock, idFactoryMock, partialEvaluator;
beforeAll(async function (done) {
beforeAll(async function () {
pdfManagerMock = new PDFManagerMock({
docBaseUrl: null,
});
@ -108,8 +108,6 @@ describe("annotation", function () {
fontCache: new RefSetCache(),
builtInCMapCache,
});
done();
});
afterAll(function () {

View File

@ -2033,16 +2033,14 @@ describe("api", function () {
.catch(done.fail);
});
it("caches image resources at the document/page level as expected (issue 11878)", async function (done) {
it("caches image resources at the document/page level as expected (issue 11878)", async function () {
const { NUM_PAGES_THRESHOLD } = GlobalImageCache,
EXPECTED_WIDTH = 2550,
EXPECTED_HEIGHT = 3300;
const loadingTask = getDocument(buildGetDocumentParams("issue11878.pdf"));
let firstImgData = null;
try {
const pdfDoc = await loadingTask.promise;
let firstImgData = null;
for (let i = 1; i <= pdfDoc.numPages; i++) {
const pdfPage = await pdfDoc.getPage(i);
@ -2076,9 +2074,7 @@ describe("api", function () {
expect(firstImgData.height).toEqual(EXPECTED_HEIGHT);
expect(firstImgData.kind).toEqual(ImageKind.RGB_24BPP);
expect(firstImgData.data instanceof Uint8ClampedArray).toEqual(
true
);
expect(firstImgData.data instanceof Uint8ClampedArray).toEqual(true);
expect(firstImgData.data.length).toEqual(25245000);
} else {
const objsPool = i >= NUM_PAGES_THRESHOLD ? commonObjs : objs;
@ -2101,10 +2097,6 @@ describe("api", function () {
await loadingTask.destroy();
firstImgData = null;
done();
} catch (ex) {
done.fail(ex);
}
});
});
describe("Multiple `getDocument` instances", function () {