Remove obsolete done callbacks from the unit tests
The done callbacks are an outdated mechanism to signal Jasmine that a unit test is done, mostly in cases where a unit test needed to wait for an asynchronous operation to complete before doing its assertions. Nowadays a much better mechanism is in place for that, namely simply passing an asynchronous function to Jasmine, so we don't need callbacks anymore (which require more code and may be more difficult to reason about). In these particular cases though the done callbacks never had any real use since nothing asynchronous happens in these places. Synchronous functions don't need to use done callbacks since Jasmine simply knows it's done when the function reaches its normal end, so we can safely get rid of these callbacks. The telltale sign is if the done callback is used unconditionally at the end of the function. This is all done in an effort to over time get rid of all callbacks in the unit test code.
This commit is contained in:
parent
d9d626a5e1
commit
10574a0f8a
@ -194,10 +194,9 @@ describe("annotation", function () {
|
|||||||
describe("getQuadPoints", function () {
|
describe("getQuadPoints", function () {
|
||||||
let dict, rect;
|
let dict, rect;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function () {
|
||||||
dict = new Dict();
|
dict = new Dict();
|
||||||
rect = [];
|
rect = [];
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
@ -299,10 +298,9 @@ describe("annotation", function () {
|
|||||||
describe("Annotation", function () {
|
describe("Annotation", function () {
|
||||||
let dict, ref;
|
let dict, ref;
|
||||||
|
|
||||||
beforeAll(function (done) {
|
beforeAll(function () {
|
||||||
dict = new Dict();
|
dict = new Dict();
|
||||||
ref = Ref.get(1, 0);
|
ref = Ref.get(1, 0);
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(function () {
|
afterAll(function () {
|
||||||
@ -497,10 +495,9 @@ describe("annotation", function () {
|
|||||||
describe("MarkupAnnotation", function () {
|
describe("MarkupAnnotation", function () {
|
||||||
let dict, ref;
|
let dict, ref;
|
||||||
|
|
||||||
beforeAll(function (done) {
|
beforeAll(function () {
|
||||||
dict = new Dict();
|
dict = new Dict();
|
||||||
ref = Ref.get(1, 0);
|
ref = Ref.get(1, 0);
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(function () {
|
afterAll(function () {
|
||||||
@ -1336,11 +1333,10 @@ describe("annotation", function () {
|
|||||||
describe("WidgetAnnotation", function () {
|
describe("WidgetAnnotation", function () {
|
||||||
let widgetDict;
|
let widgetDict;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function () {
|
||||||
widgetDict = new Dict();
|
widgetDict = new Dict();
|
||||||
widgetDict.set("Type", Name.get("Annot"));
|
widgetDict.set("Type", Name.get("Annot"));
|
||||||
widgetDict.set("Subtype", Name.get("Widget"));
|
widgetDict.set("Subtype", Name.get("Widget"));
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
@ -1438,7 +1434,7 @@ describe("annotation", function () {
|
|||||||
describe("TextWidgetAnnotation", function () {
|
describe("TextWidgetAnnotation", function () {
|
||||||
let textWidgetDict, helvRefObj, gothRefObj;
|
let textWidgetDict, helvRefObj, gothRefObj;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function () {
|
||||||
textWidgetDict = new Dict();
|
textWidgetDict = new Dict();
|
||||||
textWidgetDict.set("Type", Name.get("Annot"));
|
textWidgetDict.set("Type", Name.get("Annot"));
|
||||||
textWidgetDict.set("Subtype", Name.get("Widget"));
|
textWidgetDict.set("Subtype", Name.get("Widget"));
|
||||||
@ -1486,8 +1482,6 @@ describe("annotation", function () {
|
|||||||
textWidgetDict.set("DA", "/Helv 5 Tf");
|
textWidgetDict.set("DA", "/Helv 5 Tf");
|
||||||
textWidgetDict.set("DR", resourceDict);
|
textWidgetDict.set("DR", resourceDict);
|
||||||
textWidgetDict.set("Rect", [0, 0, 32, 10]);
|
textWidgetDict.set("Rect", [0, 0, 32, 10]);
|
||||||
|
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
@ -2315,12 +2309,11 @@ describe("annotation", function () {
|
|||||||
describe("ButtonWidgetAnnotation", function () {
|
describe("ButtonWidgetAnnotation", function () {
|
||||||
let buttonWidgetDict;
|
let buttonWidgetDict;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function () {
|
||||||
buttonWidgetDict = new Dict();
|
buttonWidgetDict = new Dict();
|
||||||
buttonWidgetDict.set("Type", Name.get("Annot"));
|
buttonWidgetDict.set("Type", Name.get("Annot"));
|
||||||
buttonWidgetDict.set("Subtype", Name.get("Widget"));
|
buttonWidgetDict.set("Subtype", Name.get("Widget"));
|
||||||
buttonWidgetDict.set("FT", Name.get("Btn"));
|
buttonWidgetDict.set("FT", Name.get("Btn"));
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
@ -3275,7 +3268,7 @@ describe("annotation", function () {
|
|||||||
describe("ChoiceWidgetAnnotation", function () {
|
describe("ChoiceWidgetAnnotation", function () {
|
||||||
let choiceWidgetDict, fontRefObj;
|
let choiceWidgetDict, fontRefObj;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function () {
|
||||||
choiceWidgetDict = new Dict();
|
choiceWidgetDict = new Dict();
|
||||||
choiceWidgetDict.set("Type", Name.get("Annot"));
|
choiceWidgetDict.set("Type", Name.get("Annot"));
|
||||||
choiceWidgetDict.set("Subtype", Name.get("Widget"));
|
choiceWidgetDict.set("Subtype", Name.get("Widget"));
|
||||||
@ -3296,8 +3289,6 @@ describe("annotation", function () {
|
|||||||
choiceWidgetDict.set("DA", "/Helv 5 Tf");
|
choiceWidgetDict.set("DA", "/Helv 5 Tf");
|
||||||
choiceWidgetDict.set("DR", resourceDict);
|
choiceWidgetDict.set("DR", resourceDict);
|
||||||
choiceWidgetDict.set("Rect", [0, 0, 32, 10]);
|
choiceWidgetDict.set("Rect", [0, 0, 32, 10]);
|
||||||
|
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
|
@ -55,14 +55,12 @@ describe("api", function () {
|
|||||||
|
|
||||||
let CanvasFactory;
|
let CanvasFactory;
|
||||||
|
|
||||||
beforeAll(function (done) {
|
beforeAll(function () {
|
||||||
CanvasFactory = new DefaultCanvasFactory();
|
CanvasFactory = new DefaultCanvasFactory();
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(function (done) {
|
afterAll(function () {
|
||||||
CanvasFactory = null;
|
CanvasFactory = null;
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function waitSome(callback) {
|
function waitSome(callback) {
|
||||||
|
@ -41,7 +41,7 @@ describe("CFFParser", function () {
|
|||||||
|
|
||||||
let fontData, parser, cff;
|
let fontData, parser, cff;
|
||||||
|
|
||||||
beforeAll(function (done) {
|
beforeAll(function () {
|
||||||
// This example font comes from the CFF spec:
|
// This example font comes from the CFF spec:
|
||||||
// http://www.adobe.com/content/dam/Adobe/en/devnet/font/pdfs/5176.CFF.pdf
|
// http://www.adobe.com/content/dam/Adobe/en/devnet/font/pdfs/5176.CFF.pdf
|
||||||
const exampleFont =
|
const exampleFont =
|
||||||
@ -61,22 +61,19 @@ describe("CFFParser", function () {
|
|||||||
fontArr.push(parseInt(hex, 16));
|
fontArr.push(parseInt(hex, 16));
|
||||||
}
|
}
|
||||||
fontData = new Stream(fontArr);
|
fontData = new Stream(fontArr);
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(function () {
|
afterAll(function () {
|
||||||
fontData = null;
|
fontData = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function () {
|
||||||
parser = new CFFParser(fontData, {}, SEAC_ANALYSIS_ENABLED);
|
parser = new CFFParser(fontData, {}, SEAC_ANALYSIS_ENABLED);
|
||||||
cff = parser.parse();
|
cff = parser.parse();
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(function (done) {
|
afterEach(function () {
|
||||||
parser = cff = null;
|
parser = cff = null;
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("parses header", function () {
|
it("parses header", function () {
|
||||||
|
@ -22,7 +22,7 @@ import { StringStream } from "../../src/core/stream.js";
|
|||||||
describe("cmap", function () {
|
describe("cmap", function () {
|
||||||
let fetchBuiltInCMap;
|
let fetchBuiltInCMap;
|
||||||
|
|
||||||
beforeAll(function (done) {
|
beforeAll(function () {
|
||||||
// Allow CMap testing in Node.js, e.g. for Travis.
|
// Allow CMap testing in Node.js, e.g. for Travis.
|
||||||
const CMapReaderFactory = new DefaultCMapReaderFactory({
|
const CMapReaderFactory = new DefaultCMapReaderFactory({
|
||||||
baseUrl: CMAP_PARAMS.cMapUrl,
|
baseUrl: CMAP_PARAMS.cMapUrl,
|
||||||
@ -34,7 +34,6 @@ describe("cmap", function () {
|
|||||||
name,
|
name,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(function () {
|
afterAll(function () {
|
||||||
|
@ -52,14 +52,12 @@ describe("colorspace", function () {
|
|||||||
describe("ColorSpace caching", function () {
|
describe("ColorSpace caching", function () {
|
||||||
let localColorSpaceCache = null;
|
let localColorSpaceCache = null;
|
||||||
|
|
||||||
beforeAll(function (done) {
|
beforeAll(function () {
|
||||||
localColorSpaceCache = new LocalColorSpaceCache();
|
localColorSpaceCache = new LocalColorSpaceCache();
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(function (done) {
|
afterAll(function () {
|
||||||
localColorSpaceCache = null;
|
localColorSpaceCache = null;
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("caching by Name", function () {
|
it("caching by Name", function () {
|
||||||
|
@ -639,7 +639,7 @@ describe("CipherTransformFactory", function () {
|
|||||||
let fileId1, fileId2, dict1, dict2, dict3;
|
let fileId1, fileId2, dict1, dict2, dict3;
|
||||||
let aes256Dict, aes256IsoDict, aes256BlankDict, aes256IsoBlankDict;
|
let aes256Dict, aes256IsoDict, aes256BlankDict, aes256IsoBlankDict;
|
||||||
|
|
||||||
beforeAll(function (done) {
|
beforeAll(function () {
|
||||||
fileId1 = unescape("%F6%C6%AF%17%F3rR%8DRM%9A%80%D1%EF%DF%18");
|
fileId1 = unescape("%F6%C6%AF%17%F3rR%8DRM%9A%80%D1%EF%DF%18");
|
||||||
fileId2 = unescape("%3CL_%3AD%96%AF@%9A%9D%B3%3Cx%1Cv%AC");
|
fileId2 = unescape("%3CL_%3AD%96%AF@%9A%9D%B3%3Cx%1Cv%AC");
|
||||||
|
|
||||||
@ -775,8 +775,6 @@ describe("CipherTransformFactory", function () {
|
|||||||
P: -1084,
|
P: -1084,
|
||||||
R: 6,
|
R: 6,
|
||||||
});
|
});
|
||||||
|
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(function () {
|
afterAll(function () {
|
||||||
@ -839,7 +837,7 @@ describe("CipherTransformFactory", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("Encrypt and decrypt", function () {
|
describe("Encrypt and decrypt", function () {
|
||||||
it("should encrypt and decrypt using ARCFour", function (done) {
|
it("should encrypt and decrypt using ARCFour", function () {
|
||||||
dict3.CF = buildDict({
|
dict3.CF = buildDict({
|
||||||
Identity: buildDict({
|
Identity: buildDict({
|
||||||
CFM: Name.get("V2"),
|
CFM: Name.get("V2"),
|
||||||
@ -847,9 +845,8 @@ describe("CipherTransformFactory", function () {
|
|||||||
});
|
});
|
||||||
const dict = buildDict(dict3);
|
const dict = buildDict(dict3);
|
||||||
ensureEncryptDecryptIsIdentity(dict, fileId1, "user", "hello world");
|
ensureEncryptDecryptIsIdentity(dict, fileId1, "user", "hello world");
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
it("should encrypt and decrypt using AES128", function (done) {
|
it("should encrypt and decrypt using AES128", function () {
|
||||||
dict3.CF = buildDict({
|
dict3.CF = buildDict({
|
||||||
Identity: buildDict({
|
Identity: buildDict({
|
||||||
CFM: Name.get("AESV2"),
|
CFM: Name.get("AESV2"),
|
||||||
@ -869,9 +866,8 @@ describe("CipherTransformFactory", function () {
|
|||||||
"user",
|
"user",
|
||||||
"aaaaaaaaaaaaaaaaaaa"
|
"aaaaaaaaaaaaaaaaaaa"
|
||||||
);
|
);
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
it("should encrypt and decrypt using AES256", function (done) {
|
it("should encrypt and decrypt using AES256", function () {
|
||||||
dict3.CF = buildDict({
|
dict3.CF = buildDict({
|
||||||
Identity: buildDict({
|
Identity: buildDict({
|
||||||
CFM: Name.get("AESV3"),
|
CFM: Name.get("AESV3"),
|
||||||
@ -891,7 +887,6 @@ describe("CipherTransformFactory", function () {
|
|||||||
"user",
|
"user",
|
||||||
"aaaaaaaaaaaaaaaaaaaaaa"
|
"aaaaaaaaaaaaaaaaaaaaaa"
|
||||||
);
|
);
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -28,9 +28,8 @@ describe("display_utils", function () {
|
|||||||
describe("DOMCanvasFactory", function () {
|
describe("DOMCanvasFactory", function () {
|
||||||
let canvasFactory;
|
let canvasFactory;
|
||||||
|
|
||||||
beforeAll(function (done) {
|
beforeAll(function () {
|
||||||
canvasFactory = new DOMCanvasFactory();
|
canvasFactory = new DOMCanvasFactory();
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(function () {
|
afterAll(function () {
|
||||||
@ -121,9 +120,8 @@ describe("display_utils", function () {
|
|||||||
describe("DOMSVGFactory", function () {
|
describe("DOMSVGFactory", function () {
|
||||||
let svgFactory;
|
let svgFactory;
|
||||||
|
|
||||||
beforeAll(function (done) {
|
beforeAll(function () {
|
||||||
svgFactory = new DOMSVGFactory();
|
svgFactory = new DOMSVGFactory();
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(function () {
|
afterAll(function () {
|
||||||
|
@ -59,14 +59,13 @@ describe("evaluator", function () {
|
|||||||
|
|
||||||
let partialEvaluator;
|
let partialEvaluator;
|
||||||
|
|
||||||
beforeAll(function (done) {
|
beforeAll(function () {
|
||||||
partialEvaluator = new PartialEvaluator({
|
partialEvaluator = new PartialEvaluator({
|
||||||
xref: new XRefMock(),
|
xref: new XRefMock(),
|
||||||
handler: new HandlerMock(),
|
handler: new HandlerMock(),
|
||||||
pageIndex: 0,
|
pageIndex: 0,
|
||||||
idFactory: createIdFactory(/* pageIndex = */ 0),
|
idFactory: createIdFactory(/* pageIndex = */ 0),
|
||||||
});
|
});
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(function () {
|
afterAll(function () {
|
||||||
|
@ -40,7 +40,7 @@ describe("node_stream", function () {
|
|||||||
).href;
|
).href;
|
||||||
const pdfLength = 1016315;
|
const pdfLength = 1016315;
|
||||||
|
|
||||||
beforeAll(done => {
|
beforeAll(function () {
|
||||||
// Create http server to serve pdf data for tests.
|
// Create http server to serve pdf data for tests.
|
||||||
server = http
|
server = http
|
||||||
.createServer((request, response) => {
|
.createServer((request, response) => {
|
||||||
@ -77,13 +77,11 @@ describe("node_stream", function () {
|
|||||||
})
|
})
|
||||||
.listen(0); /* Listen on a random free port */
|
.listen(0); /* Listen on a random free port */
|
||||||
port = server.address().port;
|
port = server.address().port;
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(done => {
|
afterAll(function () {
|
||||||
// Close the server from accepting new connections after all test finishes.
|
// Close the server from accepting new connections after all test finishes.
|
||||||
server.close();
|
server.close();
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("read both http(s) and filesystem pdf files", function (done) {
|
it("read both http(s) and filesystem pdf files", function (done) {
|
||||||
|
@ -90,7 +90,7 @@ describe("primitives", function () {
|
|||||||
const testFontFile2 = "file2";
|
const testFontFile2 = "file2";
|
||||||
const testFontFile3 = "file3";
|
const testFontFile3 = "file3";
|
||||||
|
|
||||||
beforeAll(function (done) {
|
beforeAll(function () {
|
||||||
emptyDict = new Dict();
|
emptyDict = new Dict();
|
||||||
|
|
||||||
dictWithSizeKey = new Dict();
|
dictWithSizeKey = new Dict();
|
||||||
@ -100,8 +100,6 @@ describe("primitives", function () {
|
|||||||
dictWithManyKeys.set("FontFile", testFontFile);
|
dictWithManyKeys.set("FontFile", testFontFile);
|
||||||
dictWithManyKeys.set("FontFile2", testFontFile2);
|
dictWithManyKeys.set("FontFile2", testFontFile2);
|
||||||
dictWithManyKeys.set("FontFile3", testFontFile3);
|
dictWithManyKeys.set("FontFile3", testFontFile3);
|
||||||
|
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(function () {
|
afterAll(function () {
|
||||||
@ -431,9 +429,8 @@ describe("primitives", function () {
|
|||||||
const obj2 = Name.get("bar");
|
const obj2 = Name.get("bar");
|
||||||
let cache;
|
let cache;
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function () {
|
||||||
cache = new RefSetCache();
|
cache = new RefSetCache();
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
|
@ -34,7 +34,7 @@ describe("Scripting", function () {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
beforeAll(function (done) {
|
beforeAll(function () {
|
||||||
test_id = 0;
|
test_id = 0;
|
||||||
ref = 1;
|
ref = 1;
|
||||||
send_queue = new Map();
|
send_queue = new Map();
|
||||||
@ -70,7 +70,6 @@ describe("Scripting", function () {
|
|||||||
return promise.then(sbx => sbx.evalForTesting(code, key));
|
return promise.then(sbx => sbx.evalForTesting(code, key));
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(function () {
|
afterAll(function () {
|
||||||
@ -204,13 +203,12 @@ describe("Scripting", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("Util", function () {
|
describe("Util", function () {
|
||||||
beforeAll(function (done) {
|
beforeAll(function () {
|
||||||
sandbox.createSandbox({
|
sandbox.createSandbox({
|
||||||
appInfo: { language: "en-US", platform: "Linux x86_64" },
|
appInfo: { language: "en-US", platform: "Linux x86_64" },
|
||||||
objects: {},
|
objects: {},
|
||||||
calculationOrder: [],
|
calculationOrder: [],
|
||||||
});
|
});
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("printd", function () {
|
describe("printd", function () {
|
||||||
@ -486,13 +484,12 @@ describe("Scripting", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("Color", function () {
|
describe("Color", function () {
|
||||||
beforeAll(function (done) {
|
beforeAll(function () {
|
||||||
sandbox.createSandbox({
|
sandbox.createSandbox({
|
||||||
appInfo: { language: "en-US", platform: "Linux x86_64" },
|
appInfo: { language: "en-US", platform: "Linux x86_64" },
|
||||||
objects: {},
|
objects: {},
|
||||||
calculationOrder: [],
|
calculationOrder: [],
|
||||||
});
|
});
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function round(color) {
|
function round(color) {
|
||||||
@ -566,13 +563,12 @@ describe("Scripting", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("App", function () {
|
describe("App", function () {
|
||||||
beforeAll(function (done) {
|
beforeAll(function () {
|
||||||
sandbox.createSandbox({
|
sandbox.createSandbox({
|
||||||
appInfo: { language: "en-US", platform: "Linux x86_64" },
|
appInfo: { language: "en-US", platform: "Linux x86_64" },
|
||||||
objects: {},
|
objects: {},
|
||||||
calculationOrder: [],
|
calculationOrder: [],
|
||||||
});
|
});
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should test language", async () => {
|
it("should test language", async () => {
|
||||||
@ -593,14 +589,13 @@ describe("Scripting", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("AForm", function () {
|
describe("AForm", function () {
|
||||||
beforeAll(function (done) {
|
beforeAll(function () {
|
||||||
sandbox.createSandbox({
|
sandbox.createSandbox({
|
||||||
appInfo: { language: "en-US", platform: "Linux x86_64" },
|
appInfo: { language: "en-US", platform: "Linux x86_64" },
|
||||||
objects: {},
|
objects: {},
|
||||||
calculationOrder: [],
|
calculationOrder: [],
|
||||||
dispatchEventName: "_dispatchMe",
|
dispatchEventName: "_dispatchMe",
|
||||||
});
|
});
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("AFExtractNums", function () {
|
describe("AFExtractNums", function () {
|
||||||
|
@ -257,9 +257,8 @@ describe("ui_utils", function () {
|
|||||||
describe("waitOnEventOrTimeout", function () {
|
describe("waitOnEventOrTimeout", function () {
|
||||||
let eventBus;
|
let eventBus;
|
||||||
|
|
||||||
beforeAll(function (done) {
|
beforeAll(function () {
|
||||||
eventBus = new EventBus();
|
eventBus = new EventBus();
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(function () {
|
afterAll(function () {
|
||||||
|
@ -45,10 +45,9 @@ describe("unicode", function () {
|
|||||||
describe("getUnicodeForGlyph", function () {
|
describe("getUnicodeForGlyph", function () {
|
||||||
let standardMap, dingbatsMap;
|
let standardMap, dingbatsMap;
|
||||||
|
|
||||||
beforeAll(function (done) {
|
beforeAll(function () {
|
||||||
standardMap = getGlyphsUnicode();
|
standardMap = getGlyphsUnicode();
|
||||||
dingbatsMap = getDingbatsGlyphsUnicode();
|
dingbatsMap = getDingbatsGlyphsUnicode();
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(function () {
|
afterAll(function () {
|
||||||
@ -90,9 +89,8 @@ describe("unicode", function () {
|
|||||||
describe("getNormalizedUnicodes", function () {
|
describe("getNormalizedUnicodes", function () {
|
||||||
let NormalizedUnicodes;
|
let NormalizedUnicodes;
|
||||||
|
|
||||||
beforeAll(function (done) {
|
beforeAll(function () {
|
||||||
NormalizedUnicodes = getNormalizedUnicodes();
|
NormalizedUnicodes = getNormalizedUnicodes();
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(function () {
|
afterAll(function () {
|
||||||
@ -121,9 +119,8 @@ describe("unicode", function () {
|
|||||||
return char;
|
return char;
|
||||||
}
|
}
|
||||||
|
|
||||||
beforeAll(function (done) {
|
beforeAll(function () {
|
||||||
NormalizedUnicodes = getNormalizedUnicodes();
|
NormalizedUnicodes = getNormalizedUnicodes();
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(function () {
|
afterAll(function () {
|
||||||
|
@ -20,7 +20,7 @@ import { StringStream } from "../../src/core/stream.js";
|
|||||||
|
|
||||||
describe("Writer", function () {
|
describe("Writer", function () {
|
||||||
describe("Incremental update", function () {
|
describe("Incremental update", function () {
|
||||||
it("should update a file with new objects", function (done) {
|
it("should update a file with new objects", function () {
|
||||||
const originalData = new Uint8Array();
|
const originalData = new Uint8Array();
|
||||||
const newRefs = [
|
const newRefs = [
|
||||||
{ ref: Ref.get(123, 0x2d), data: "abc\n" },
|
{ ref: Ref.get(123, 0x2d), data: "abc\n" },
|
||||||
@ -58,12 +58,11 @@ describe("Writer", function () {
|
|||||||
"%%EOF\n";
|
"%%EOF\n";
|
||||||
|
|
||||||
expect(data).toEqual(expected);
|
expect(data).toEqual(expected);
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("writeDict", function () {
|
describe("writeDict", function () {
|
||||||
it("should write a Dict", function (done) {
|
it("should write a Dict", function () {
|
||||||
const dict = new Dict(null);
|
const dict = new Dict(null);
|
||||||
dict.set("A", Name.get("B"));
|
dict.set("A", Name.get("B"));
|
||||||
dict.set("B", Ref.get(123, 456));
|
dict.set("B", Ref.get(123, 456));
|
||||||
@ -93,10 +92,9 @@ describe("Writer", function () {
|
|||||||
"endstream\n>>>>";
|
"endstream\n>>>>";
|
||||||
|
|
||||||
expect(buffer.join("")).toEqual(expected);
|
expect(buffer.join("")).toEqual(expected);
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should write a Dict in escaping PDF names", function (done) {
|
it("should write a Dict in escaping PDF names", function () {
|
||||||
const dict = new Dict(null);
|
const dict = new Dict(null);
|
||||||
dict.set("\xfeA#", Name.get("hello"));
|
dict.set("\xfeA#", Name.get("hello"));
|
||||||
dict.set("B", Name.get("#hello"));
|
dict.set("B", Name.get("#hello"));
|
||||||
@ -108,7 +106,6 @@ describe("Writer", function () {
|
|||||||
const expected = "<< /#feA#23 /hello /B /#23hello /C /he#fello#ff>>";
|
const expected = "<< /#feA#23 /hello /B /#23hello /C /he#fello#ff>>";
|
||||||
|
|
||||||
expect(buffer.join("")).toEqual(expected);
|
expect(buffer.join("")).toEqual(expected);
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user