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:
parent
4814e23310
commit
eeda2215d7
@ -79,7 +79,7 @@ describe("annotation", function () {
|
|||||||
|
|
||||||
let pdfManagerMock, idFactoryMock, partialEvaluator;
|
let pdfManagerMock, idFactoryMock, partialEvaluator;
|
||||||
|
|
||||||
beforeAll(async function (done) {
|
beforeAll(async function () {
|
||||||
pdfManagerMock = new PDFManagerMock({
|
pdfManagerMock = new PDFManagerMock({
|
||||||
docBaseUrl: null,
|
docBaseUrl: null,
|
||||||
});
|
});
|
||||||
@ -108,8 +108,6 @@ describe("annotation", function () {
|
|||||||
fontCache: new RefSetCache(),
|
fontCache: new RefSetCache(),
|
||||||
builtInCMapCache,
|
builtInCMapCache,
|
||||||
});
|
});
|
||||||
|
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(function () {
|
afterAll(function () {
|
||||||
|
@ -2033,16 +2033,14 @@ describe("api", function () {
|
|||||||
.catch(done.fail);
|
.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,
|
const { NUM_PAGES_THRESHOLD } = GlobalImageCache,
|
||||||
EXPECTED_WIDTH = 2550,
|
EXPECTED_WIDTH = 2550,
|
||||||
EXPECTED_HEIGHT = 3300;
|
EXPECTED_HEIGHT = 3300;
|
||||||
|
|
||||||
const loadingTask = getDocument(buildGetDocumentParams("issue11878.pdf"));
|
const loadingTask = getDocument(buildGetDocumentParams("issue11878.pdf"));
|
||||||
let firstImgData = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
const pdfDoc = await loadingTask.promise;
|
const pdfDoc = await loadingTask.promise;
|
||||||
|
let firstImgData = null;
|
||||||
|
|
||||||
for (let i = 1; i <= pdfDoc.numPages; i++) {
|
for (let i = 1; i <= pdfDoc.numPages; i++) {
|
||||||
const pdfPage = await pdfDoc.getPage(i);
|
const pdfPage = await pdfDoc.getPage(i);
|
||||||
@ -2076,9 +2074,7 @@ describe("api", function () {
|
|||||||
expect(firstImgData.height).toEqual(EXPECTED_HEIGHT);
|
expect(firstImgData.height).toEqual(EXPECTED_HEIGHT);
|
||||||
|
|
||||||
expect(firstImgData.kind).toEqual(ImageKind.RGB_24BPP);
|
expect(firstImgData.kind).toEqual(ImageKind.RGB_24BPP);
|
||||||
expect(firstImgData.data instanceof Uint8ClampedArray).toEqual(
|
expect(firstImgData.data instanceof Uint8ClampedArray).toEqual(true);
|
||||||
true
|
|
||||||
);
|
|
||||||
expect(firstImgData.data.length).toEqual(25245000);
|
expect(firstImgData.data.length).toEqual(25245000);
|
||||||
} else {
|
} else {
|
||||||
const objsPool = i >= NUM_PAGES_THRESHOLD ? commonObjs : objs;
|
const objsPool = i >= NUM_PAGES_THRESHOLD ? commonObjs : objs;
|
||||||
@ -2101,10 +2097,6 @@ describe("api", function () {
|
|||||||
|
|
||||||
await loadingTask.destroy();
|
await loadingTask.destroy();
|
||||||
firstImgData = null;
|
firstImgData = null;
|
||||||
done();
|
|
||||||
} catch (ex) {
|
|
||||||
done.fail(ex);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe("Multiple `getDocument` instances", function () {
|
describe("Multiple `getDocument` instances", function () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user