Merge pull request #21635 from Snuffleupagus/test-toBeTrue

Use the `toBeTrue()` matcher consistently in the unit/font/integration tests
This commit is contained in:
Jonas Jenwald 2026-07-26 00:48:40 +02:00 committed by GitHub
commit e2d602122d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
44 changed files with 424 additions and 430 deletions

View File

@ -11,8 +11,8 @@ describe("font1", function () {
const output = await ttx(font1_1); const output = await ttx(font1_1);
verifyTtxOutput(output); verifyTtxOutput(output);
expect(/<ttFont /.test(output)).toEqual(true); expect(/<ttFont /.test(output)).toBeTrue();
expect(/<\/ttFont>/.test(output)).toEqual(true); expect(/<\/ttFont>/.test(output)).toBeTrue();
}); });
}); });
}); });

View File

@ -39,7 +39,7 @@ describe("font_fpgm", function () {
/(?:ENDF\[ \]|SVTCA\[0\])\s*\/\*.*\*\/\s*<\/assembly>\s*<\/fpgm>/.test( /(?:ENDF\[ \]|SVTCA\[0\])\s*\/\*.*\*\/\s*<\/assembly>\s*<\/fpgm>/.test(
output output
) )
).toEqual(true); ).toBeTrue();
}); });
}); });
}); });

View File

@ -133,9 +133,9 @@ describe("font_glyf", function () {
verifyTtxOutput(output); verifyTtxOutput(output);
expect( expect(
/<OS_2>\s*(?:<!--[\s\S]*?-->\s*)?<version value="3"\/>/.test(output) /<OS_2>\s*(?:<!--[\s\S]*?-->\s*)?<version value="3"\/>/.test(output)
).toEqual(true); ).toBeTrue();
expect(/<sCapHeight\b/.test(output)).toEqual(true); expect(/<sCapHeight\b/.test(output)).toBeTrue();
expect(/<usMaxContext\b/.test(output)).toEqual(true); expect(/<usMaxContext\b/.test(output)).toBeTrue();
}); });
}); });
}); });

View File

@ -37,7 +37,7 @@ describe("font_os2", function () {
verifyTtxOutput(output); verifyTtxOutput(output);
expect( expect(
/<OS_2>\s*<!--.*\r?\n.*-->\s*<version value="3"\/>/.test(output) /<OS_2>\s*<!--.*\r?\n.*-->\s*<version value="3"\/>/.test(output)
).toEqual(true); ).toBeTrue();
}); });
it("has invalid selection attributes presence", async function () { it("has invalid selection attributes presence", async function () {
@ -65,7 +65,7 @@ describe("font_os2", function () {
verifyTtxOutput(output); verifyTtxOutput(output);
expect( expect(
/<OS_2>\s*<!--.*\r?\n.*-->\s*<version value="3"\/>/.test(output) /<OS_2>\s*<!--.*\r?\n.*-->\s*<version value="3"\/>/.test(output)
).toEqual(true); ).toBeTrue();
}); });
}); });
}); });

View File

@ -43,7 +43,7 @@ describe("font_post", function () {
const output = await ttx(font.data); const output = await ttx(font.data);
verifyTtxOutput(output); verifyTtxOutput(output);
expect(/<post>\s*<formatType value="3\.0"\/>/.test(output)).toEqual(true); expect(/<post>\s*<formatType value="3\.0"\/>/.test(output)).toBeTrue();
}); });
it("has invalid glyph name indexes", async function () { it("has invalid glyph name indexes", async function () {
@ -65,7 +65,7 @@ describe("font_post", function () {
const output = await ttx(font.data); const output = await ttx(font.data);
verifyTtxOutput(output); verifyTtxOutput(output);
expect(/<post>\s*<formatType value="3\.0"\/>/.test(output)).toEqual(true); expect(/<post>\s*<formatType value="3\.0"\/>/.test(output)).toBeTrue();
}); });
it("has right amount of glyphs specified", async function () { it("has right amount of glyphs specified", async function () {
@ -87,7 +87,7 @@ describe("font_post", function () {
const output = await ttx(font.data); const output = await ttx(font.data);
verifyTtxOutput(output); verifyTtxOutput(output);
expect(/<post>\s*<formatType value="3\.0"\/>/.test(output)).toEqual(true); expect(/<post>\s*<formatType value="3\.0"\/>/.test(output)).toBeTrue();
}); });
}); });
}); });

View File

@ -239,7 +239,7 @@ describe("accessibility", () => {
); );
expect(isLinkedToStampAnnotation) expect(isLinkedToStampAnnotation)
.withContext(`In ${browserName}`) .withContext(`In ${browserName}`)
.toEqual(true); .toBeTrue();
}) })
); );
}); });

View File

@ -51,7 +51,7 @@ describe("Annotation highlight", () => {
highlightSelector, highlightSelector,
popupSelector popupSelector
); );
expect(areSiblings).withContext(`In ${browserName}`).toEqual(true); expect(areSiblings).withContext(`In ${browserName}`).toBeTrue();
}) })
); );
}); });
@ -63,7 +63,7 @@ describe("Annotation highlight", () => {
getAnnotationSelector("21R"), getAnnotationSelector("21R"),
el => el.hidden el => el.hidden
); );
expect(hidden).withContext(`In ${browserName}`).toEqual(true); expect(hidden).withContext(`In ${browserName}`).toBeTrue();
await page.hover(getAnnotationSelector("19R")); await page.hover(getAnnotationSelector("19R"));
await page.waitForSelector(getAnnotationSelector("21R"), { await page.waitForSelector(getAnnotationSelector("21R"), {
visible: true, visible: true,
@ -159,7 +159,7 @@ describe("Checkbox annotation", () => {
await page.waitForFunction( await page.waitForFunction(
`document.querySelector('${selector} input').checked` `document.querySelector('${selector} input').checked`
); );
expect(true).withContext(`In ${browserName}`).toEqual(true); expect(true).withContext(`In ${browserName}`).toBeTrue();
}) })
); );
}); });
@ -343,7 +343,7 @@ describe("Annotation and storage", () => {
getSelector(checkId), getSelector(checkId),
el => el.checked el => el.checked
); );
expect(checked).toEqual(true); expect(checked).toBeTrue();
checked = await page.$eval(getSelector(radio1Id), el => el.checked); checked = await page.$eval(getSelector(radio1Id), el => el.checked);
expect(checked).toBeFalse(); expect(checked).toBeFalse();
@ -449,13 +449,13 @@ describe("ResetForm action", () => {
`${getSelector("78R")} [value="a"]`, `${getSelector("78R")} [value="a"]`,
el => el.selected el => el.selected
); );
expect(selected).withContext(`In ${browserName}`).toEqual(true); expect(selected).withContext(`In ${browserName}`).toBeTrue();
selected = await page.$eval( selected = await page.$eval(
`${getSelector("81R")} [value="d"]`, `${getSelector("81R")} [value="d"]`,
el => el.selected el => el.selected
); );
expect(selected).withContext(`In ${browserName}`).toEqual(true); expect(selected).withContext(`In ${browserName}`).toBeTrue();
}) })
); );
}); });
@ -504,20 +504,20 @@ describe("ResetForm action", () => {
getSelector(`${id}R`), getSelector(`${id}R`),
el => el.checked el => el.checked
); );
expect(checked).withContext(`In ${browserName}`).toEqual(true); expect(checked).withContext(`In ${browserName}`).toBeTrue();
} }
let selected = await page.$eval( let selected = await page.$eval(
`${getSelector("78R")} [value="a"]`, `${getSelector("78R")} [value="a"]`,
el => el.selected el => el.selected
); );
expect(selected).withContext(`In ${browserName}`).toEqual(true); expect(selected).withContext(`In ${browserName}`).toBeTrue();
selected = await page.$eval( selected = await page.$eval(
`${getSelector("81R")} [value="f"]`, `${getSelector("81R")} [value="f"]`,
el => el.selected el => el.selected
); );
expect(selected).withContext(`In ${browserName}`).toEqual(true); expect(selected).withContext(`In ${browserName}`).toBeTrue();
}) })
); );
}); });
@ -636,7 +636,7 @@ describe("ResetForm action", () => {
pages.map(async ([browserName, page]) => { pages.map(async ([browserName, page]) => {
const selector = getAnnotationSelector("21R"); const selector = getAnnotationSelector("21R");
let hidden = await page.$eval(selector, el => el.hidden); let hidden = await page.$eval(selector, el => el.hidden);
expect(hidden).withContext(`In ${browserName}`).toEqual(true); expect(hidden).withContext(`In ${browserName}`).toBeTrue();
await page.focus(getAnnotationSelector("20R")); await page.focus(getAnnotationSelector("20R"));
await page.keyboard.press("Enter"); await page.keyboard.press("Enter");
@ -651,7 +651,7 @@ describe("ResetForm action", () => {
`document.querySelector('${selector}').hidden !== false` `document.querySelector('${selector}').hidden !== false`
); );
hidden = await page.$eval(selector, el => el.hidden); hidden = await page.$eval(selector, el => el.hidden);
expect(hidden).withContext(`In ${browserName}`).toEqual(true); expect(hidden).withContext(`In ${browserName}`).toBeTrue();
await page.keyboard.press("Enter"); await page.keyboard.press("Enter");
await page.waitForFunction( await page.waitForFunction(
@ -665,7 +665,7 @@ describe("ResetForm action", () => {
`document.querySelector('${selector}').hidden !== false` `document.querySelector('${selector}').hidden !== false`
); );
hidden = await page.$eval(selector, el => el.hidden); hidden = await page.$eval(selector, el => el.hidden);
expect(hidden).withContext(`In ${browserName}`).toEqual(true); expect(hidden).withContext(`In ${browserName}`).toBeTrue();
}) })
); );
}); });
@ -999,7 +999,7 @@ describe("RichMedia annotation", () => {
const hasSource = await page.$eval(videoSelector, el => const hasSource = await page.$eval(videoSelector, el =>
el.src.startsWith("blob:") el.src.startsWith("blob:")
); );
expect(hasSource).withContext(`In ${browserName}`).toEqual(true); expect(hasSource).withContext(`In ${browserName}`).toBeTrue();
}) })
); );
}); });
@ -1020,7 +1020,7 @@ describe("RichMedia annotation", () => {
const hasSource = await page.$eval(audioSelector, el => const hasSource = await page.$eval(audioSelector, el =>
el.src.startsWith("blob:") el.src.startsWith("blob:")
); );
expect(hasSource).withContext(`In ${browserName}`).toEqual(true); expect(hasSource).withContext(`In ${browserName}`).toBeTrue();
}) })
); );
}); });
@ -1056,7 +1056,7 @@ describe("Screen annotation (rendition)", () => {
const hasSource = await page.$eval(videoSelector, el => const hasSource = await page.$eval(videoSelector, el =>
el.src.startsWith("blob:") el.src.startsWith("blob:")
); );
expect(hasSource).withContext(`In ${browserName}`).toEqual(true); expect(hasSource).withContext(`In ${browserName}`).toBeTrue();
}) })
); );
}); });
@ -1075,7 +1075,7 @@ describe("Screen annotation (rendition)", () => {
const hasSource = await page.$eval(audioSelector, el => const hasSource = await page.$eval(audioSelector, el =>
el.src.startsWith("blob:") el.src.startsWith("blob:")
); );
expect(hasSource).withContext(`In ${browserName}`).toEqual(true); expect(hasSource).withContext(`In ${browserName}`).toBeTrue();
}) })
); );
}); });
@ -1111,7 +1111,7 @@ describe("Sound annotation", () => {
const hasSource = await page.$eval(audioSelector, el => const hasSource = await page.$eval(audioSelector, el =>
el.src.startsWith("blob:") el.src.startsWith("blob:")
); );
expect(hasSource).withContext(`In ${browserName}`).toEqual(true); expect(hasSource).withContext(`In ${browserName}`).toBeTrue();
}) })
); );
}); });

View File

@ -76,60 +76,60 @@ describe("Copy and paste", () => {
text.includes("This section provides an overview of our system") text.includes("This section provides an overview of our system")
) )
.withContext(`In ${browserName}`) .withContext(`In ${browserName}`)
.toEqual(true); .toBeTrue();
expect( expect(
text.includes( text.includes(
"are represented by function calls. This makes the LIR used by" "are represented by function calls. This makes the LIR used by"
) )
) )
.withContext(`In ${browserName}`) .withContext(`In ${browserName}`)
.toEqual(true); .toBeTrue();
expect( expect(
text.includes("When compiling loops, we consult the oracle before") text.includes("When compiling loops, we consult the oracle before")
) )
.withContext(`In ${browserName}`) .withContext(`In ${browserName}`)
.toEqual(true); .toBeTrue();
expect(text.includes("Nested Trace Tree Formation")) expect(text.includes("Nested Trace Tree Formation"))
.withContext(`In ${browserName}`) .withContext(`In ${browserName}`)
.toEqual(true); .toBeTrue();
expect( expect(
text.includes( text.includes(
"An important detail is that the call to the inner trace" "An important detail is that the call to the inner trace"
) )
) )
.withContext(`In ${browserName}`) .withContext(`In ${browserName}`)
.toEqual(true); .toBeTrue();
expect(text.includes("When trace recording is completed, nanojit")) expect(text.includes("When trace recording is completed, nanojit"))
.withContext(`In ${browserName}`) .withContext(`In ${browserName}`)
.toEqual(true); .toBeTrue();
expect( expect(
text.includes( text.includes(
"SpiderMonkey, like many VMs, needs to preempt the user program" "SpiderMonkey, like many VMs, needs to preempt the user program"
) )
) )
.withContext(`In ${browserName}`) .withContext(`In ${browserName}`)
.toEqual(true); .toBeTrue();
expect( expect(
text.includes( text.includes(
"Using similar computations, we find that trace recording takes" "Using similar computations, we find that trace recording takes"
) )
) )
.withContext(`In ${browserName}`) .withContext(`In ${browserName}`)
.toEqual(true); .toBeTrue();
expect( expect(
text.includes( text.includes(
"specialization algorithm. We also described our trace compiler" "specialization algorithm. We also described our trace compiler"
) )
) )
.withContext(`In ${browserName}`) .withContext(`In ${browserName}`)
.toEqual(true); .toBeTrue();
expect( expect(
text.includes( text.includes(
"dynamic optimization system. In Proceedings of the ACM SIGPLAN" "dynamic optimization system. In Proceedings of the ACM SIGPLAN"
) )
) )
.withContext(`In ${browserName}`) .withContext(`In ${browserName}`)
.toEqual(true); .toBeTrue();
}) })
); );
}); });

View File

@ -278,7 +278,7 @@ describe("FreeText Editor", () => {
sel => !!document.querySelector(sel), sel => !!document.querySelector(sel),
editorSelector editorSelector
); );
expect(hasEditor).withContext(`In ${browserName}`).toEqual(true); expect(hasEditor).withContext(`In ${browserName}`).toBeTrue();
} }
await waitForStorageEntries(page, 3); await waitForStorageEntries(page, 3);
@ -667,7 +667,7 @@ describe("FreeText Editor", () => {
); );
expect(newAriaOwns.endsWith("_0-editor")) expect(newAriaOwns.endsWith("_0-editor"))
.withContext(`In ${browserName}`) .withContext(`In ${browserName}`)
.toEqual(true); .toBeTrue();
}) })
); );
}); });
@ -1389,7 +1389,7 @@ describe("FreeText Editor", () => {
let height = bbox[3] - bbox[1]; let height = bbox[3] - bbox[1];
expect(width < height) expect(width < height)
.withContext(`In ${browserName}`) .withContext(`In ${browserName}`)
.toEqual(true); .toBeTrue();
await page.evaluate(() => { await page.evaluate(() => {
window.PDFViewerApplication.rotatePages(270); window.PDFViewerApplication.rotatePages(270);
@ -1439,7 +1439,7 @@ describe("FreeText Editor", () => {
height = bbox[3] - bbox[1]; height = bbox[3] - bbox[1];
expect(width < height) expect(width < height)
.withContext(`In ${browserName}`) .withContext(`In ${browserName}`)
.toEqual(true); .toBeTrue();
}) })
); );
}); });
@ -1624,7 +1624,7 @@ describe("FreeText Editor", () => {
.withContext( .withContext(
`In ${browserName}, first pix coords in editor: ${editorFirstPix} and in annotation: ${annotationFirstPix}` `In ${browserName}, first pix coords in editor: ${editorFirstPix} and in annotation: ${annotationFirstPix}`
) )
.toEqual(true); .toBeTrue();
} }
}) })
); );
@ -1792,7 +1792,7 @@ describe("FreeText Editor", () => {
.withContext( .withContext(
`In ${browserName}, first pix coords in editor: ${editorFirstPix} and in annotation: ${annotationFirstPix}` `In ${browserName}, first pix coords in editor: ${editorFirstPix} and in annotation: ${annotationFirstPix}`
) )
.toEqual(true); .toBeTrue();
} }
}) })
); );

View File

@ -667,10 +667,10 @@ describe("Highlight Editor", () => {
// layer we can't be sure of the dimensions. // layer we can't be sure of the dimensions.
expect(Math.abs(w - 73) <= 2) expect(Math.abs(w - 73) <= 2)
.withContext(`In ${browserName}`) .withContext(`In ${browserName}`)
.toBe(true); .toBeTrue();
expect(Math.abs(h - 9) <= 2) expect(Math.abs(h - 9) <= 2)
.withContext(`In ${browserName}`) .withContext(`In ${browserName}`)
.toBe(true); .toBeTrue();
}) })
); );
}); });
@ -745,16 +745,16 @@ describe("Highlight Editor", () => {
expect(Math.abs(rectDiv.x - rectSVG.x) <= 2) expect(Math.abs(rectDiv.x - rectSVG.x) <= 2)
.withContext(`In ${browserName}`) .withContext(`In ${browserName}`)
.toBe(true); .toBeTrue();
expect(Math.abs(rectDiv.y - rectSVG.y) <= 2) expect(Math.abs(rectDiv.y - rectSVG.y) <= 2)
.withContext(`In ${browserName}`) .withContext(`In ${browserName}`)
.toBe(true); .toBeTrue();
expect(Math.abs(rectDiv.height - rectSVG.height) <= 2) expect(Math.abs(rectDiv.height - rectSVG.height) <= 2)
.withContext(`In ${browserName}`) .withContext(`In ${browserName}`)
.toBe(true); .toBeTrue();
expect(Math.abs(rectDiv.width - rectSVG.width) <= 2) expect(Math.abs(rectDiv.width - rectSVG.width) <= 2)
.withContext(`In ${browserName}`) .withContext(`In ${browserName}`)
.toBe(true); .toBeTrue();
}) })
); );
}); });
@ -889,7 +889,7 @@ describe("Highlight Editor", () => {
.toBeFalse(); .toBeFalse();
expect(editingEvent.hasSelectedText) expect(editingEvent.hasSelectedText)
.withContext(`In ${browserName}`) .withContext(`In ${browserName}`)
.toBe(true); .toBeTrue();
// Click somewhere to unselect the current selection. // Click somewhere to unselect the current selection.
await page.mouse.click(rect.x + rect.width + 10, y, { count: 1 }); await page.mouse.click(rect.x + rect.width + 10, y, { count: 1 });

View File

@ -251,7 +251,7 @@ describe("Interaction", () => {
await page.type(getSelector("405R"), "employee"); await page.type(getSelector("405R"), "employee");
let checked = await page.$eval(getSelector("449R"), el => el.checked); let checked = await page.$eval(getSelector("449R"), el => el.checked);
expect(checked).toEqual(true); expect(checked).toBeTrue();
// click on reset button // click on reset button
await page.click(getAnnotationSelector("402R")); await page.click(getAnnotationSelector("402R"));
@ -1888,15 +1888,13 @@ describe("Interaction", () => {
`${selector} > canvas`, `${selector} > canvas`,
elem => getComputedStyle(elem).display !== "none" elem => getComputedStyle(elem).display !== "none"
); );
expect(hasVisibleCanvas) expect(hasVisibleCanvas).withContext(`In ${browserName}`).toBeTrue();
.withContext(`In ${browserName}`)
.toEqual(true);
const hasHiddenInput = await page.$eval( const hasHiddenInput = await page.$eval(
`${selector} > input`, `${selector} > input`,
elem => getComputedStyle(elem).display === "none" elem => getComputedStyle(elem).display === "none"
); );
expect(hasHiddenInput).withContext(`In ${browserName}`).toEqual(true); expect(hasHiddenInput).withContext(`In ${browserName}`).toBeTrue();
await page.click(getSelector("12R")); await page.click(getSelector("12R"));
await page.waitForFunction( await page.waitForFunction(
@ -1911,17 +1909,13 @@ describe("Interaction", () => {
`${selector} > canvas`, `${selector} > canvas`,
elem => getComputedStyle(elem).display === "none" elem => getComputedStyle(elem).display === "none"
); );
expect(hasHiddenCanvas) expect(hasHiddenCanvas).withContext(`In ${browserName}`).toBeTrue();
.withContext(`In ${browserName}`)
.toEqual(true);
const hasVisibleInput = await page.$eval( const hasVisibleInput = await page.$eval(
`${selector} > input`, `${selector} > input`,
elem => getComputedStyle(elem).display !== "none" elem => getComputedStyle(elem).display !== "none"
); );
expect(hasVisibleInput) expect(hasVisibleInput).withContext(`In ${browserName}`).toBeTrue();
.withContext(`In ${browserName}`)
.toEqual(true);
}) })
); );
}); });
@ -2006,17 +2000,17 @@ describe("Interaction", () => {
getSelector("353R"), getSelector("353R"),
el => el.disabled el => el.disabled
); );
expect(readonly).withContext(`In ${browserName}`).toEqual(true); expect(readonly).withContext(`In ${browserName}`).toBeTrue();
await page.click(getSelector("334R")); await page.click(getSelector("334R"));
await waitForSandboxTrip(page); await waitForSandboxTrip(page);
readonly = await page.$eval(getSelector("353R"), el => el.disabled); readonly = await page.$eval(getSelector("353R"), el => el.disabled);
expect(readonly).withContext(`In ${browserName}`).toEqual(true); expect(readonly).withContext(`In ${browserName}`).toBeTrue();
await page.click(getSelector("351R")); await page.click(getSelector("351R"));
await waitForSandboxTrip(page); await waitForSandboxTrip(page);
readonly = await page.$eval(getSelector("353R"), el => el.disabled); readonly = await page.$eval(getSelector("353R"), el => el.disabled);
expect(readonly).withContext(`In ${browserName}`).toEqual(true); expect(readonly).withContext(`In ${browserName}`).toBeTrue();
await page.click(getSelector("352R")); await page.click(getSelector("352R"));
await page.waitForFunction( await page.waitForFunction(
`${getQuerySelector("353R")}.disabled !== true` `${getQuerySelector("353R")}.disabled !== true`
@ -2031,7 +2025,7 @@ describe("Interaction", () => {
); );
let checked = await page.$eval(getSelector("353R"), el => el.checked); let checked = await page.$eval(getSelector("353R"), el => el.checked);
expect(checked).withContext(`In ${browserName}`).toEqual(true); expect(checked).withContext(`In ${browserName}`).toBeTrue();
await page.click(getSelector("334R")); await page.click(getSelector("334R"));
await page.waitForFunction( await page.waitForFunction(
`${getQuerySelector("353R")}.disabled !== false` `${getQuerySelector("353R")}.disabled !== false`
@ -2041,7 +2035,7 @@ describe("Interaction", () => {
); );
readonly = await page.$eval(getSelector("353R"), el => el.disabled); readonly = await page.$eval(getSelector("353R"), el => el.disabled);
expect(readonly).withContext(`In ${browserName}`).toEqual(true); expect(readonly).withContext(`In ${browserName}`).toBeTrue();
checked = await page.$eval(getSelector("353R"), el => el.checked); checked = await page.$eval(getSelector("353R"), el => el.checked);
expect(checked).withContext(`In ${browserName}`).toBeFalse(); expect(checked).withContext(`In ${browserName}`).toBeFalse();
}) })
@ -2739,8 +2733,8 @@ describe("Interaction", () => {
expect(value) expect(value)
.withContext(`In ${browserName}`) .withContext(`In ${browserName}`)
.toEqual("Hello PDF.js"); .toEqual("Hello PDF.js");
expect(isFieldVisible).withContext(`In ${browserName}`).toBe(true); expect(isFieldVisible).withContext(`In ${browserName}`).toBeTrue();
expect(isCanvasHidden).withContext(`In ${browserName}`).toBe(true); expect(isCanvasHidden).withContext(`In ${browserName}`).toBeTrue();
}) })
); );
}); });

View File

@ -555,10 +555,10 @@ describe("Stamp Editor", () => {
let [newWidth, newHeight] = await getDims(); let [newWidth, newHeight] = await getDims();
expect(newWidth > width + 30) expect(newWidth > width + 30)
.withContext(`In ${browserName}`) .withContext(`In ${browserName}`)
.toEqual(true); .toBeTrue();
expect(newHeight > height + 30) expect(newHeight > height + 30)
.withContext(`In ${browserName}`) .withContext(`In ${browserName}`)
.toEqual(true); .toBeTrue();
for (let i = 0; i < 4; i++) { for (let i = 0; i < 4; i++) {
await kbBigMoveRight(page); await kbBigMoveRight(page);
@ -569,10 +569,10 @@ describe("Stamp Editor", () => {
[newWidth, newHeight] = await getDims(); [newWidth, newHeight] = await getDims();
expect(Math.abs(newWidth - width) < 2) expect(Math.abs(newWidth - width) < 2)
.withContext(`In ${browserName}`) .withContext(`In ${browserName}`)
.toEqual(true); .toBeTrue();
expect(Math.abs(newHeight - height) < 2) expect(Math.abs(newHeight - height) < 2)
.withContext(`In ${browserName}`) .withContext(`In ${browserName}`)
.toEqual(true); .toBeTrue();
// Move the focus to the next resizer. // Move the focus to the next resizer.
await page.keyboard.press("Tab"); await page.keyboard.press("Tab");
@ -589,7 +589,7 @@ describe("Stamp Editor", () => {
[, newHeight] = await getDims(); [, newHeight] = await getDims();
expect(newHeight > height + 50) expect(newHeight > height + 50)
.withContext(`In ${browserName}`) .withContext(`In ${browserName}`)
.toEqual(true); .toBeTrue();
for (let i = 0; i < 4; i++) { for (let i = 0; i < 4; i++) {
await kbBigMoveDown(page); await kbBigMoveDown(page);
@ -600,7 +600,7 @@ describe("Stamp Editor", () => {
[, newHeight] = await getDims(); [, newHeight] = await getDims();
expect(Math.abs(newHeight - height) < 2) expect(Math.abs(newHeight - height) < 2)
.withContext(`In ${browserName}`) .withContext(`In ${browserName}`)
.toEqual(true); .toBeTrue();
// Escape should remove the focus from the resizer. // Escape should remove the focus from the resizer.
await page.keyboard.press("Escape"); await page.keyboard.press("Escape");

View File

@ -95,7 +95,7 @@ describe("Text layer images", () => {
}, imageCanvas) }, imageCanvas)
) )
.withContext(`Image is not all the same pixel, in ${browserName}`) .withContext(`Image is not all the same pixel, in ${browserName}`)
.toBe(true); .toBeTrue();
}) })
); );
}); });

View File

@ -66,7 +66,7 @@ describe("PDF viewer", () => {
); );
expect(attachmentsEnabled) expect(attachmentsEnabled)
.withContext(`In ${browserName}`) .withContext(`In ${browserName}`)
.toBe(true); .toBeTrue();
// Switch to the attachments view. // Switch to the attachments view.
await page.click("#attachmentsViewMenu"); await page.click("#attachmentsViewMenu");
@ -85,7 +85,7 @@ describe("PDF viewer", () => {
); );
return !!textLayer && !!canvas; return !!textLayer && !!canvas;
}); });
expect(stillRendered).withContext(`In ${browserName}`).toBe(true); expect(stillRendered).withContext(`In ${browserName}`).toBeTrue();
}) })
); );
}); });
@ -221,7 +221,7 @@ describe("PDF viewer", () => {
); );
expect(scrollTop < 100) expect(scrollTop < 100)
.withContext(`In ${browserName}`) .withContext(`In ${browserName}`)
.toBe(true); .toBeTrue();
} }
}) })
); );
@ -486,7 +486,7 @@ describe("PDF viewer", () => {
expect(buffer.every(x => x === 0xff0000ff)) expect(buffer.every(x => x === 0xff0000ff))
.withContext(`In ${browserName}, in the ${i}th zoom in`) .withContext(`In ${browserName}, in the ${i}th zoom in`)
.toBe(true); .toBeTrue();
const currentScale = await page.evaluate( const currentScale = await page.evaluate(
() => window.PDFViewerApplication.pdfViewer.currentScale () => window.PDFViewerApplication.pdfViewer.currentScale
@ -834,7 +834,7 @@ describe("PDF viewer", () => {
detailCanvasSelector detailCanvasSelector
); );
expect(isSame).withContext(`In ${browserName}`).toBe(true); expect(isSame).withContext(`In ${browserName}`).toBeTrue();
expect(rendered).withContext(`In ${browserName}`).toBeFalse(); expect(rendered).withContext(`In ${browserName}`).toBeFalse();
}); });
}); });

View File

@ -378,9 +378,9 @@ describe("annotation", function () {
}); });
annotation.setFlags(13); annotation.setFlags(13);
expect(annotation.hasFlag(AnnotationFlag.INVISIBLE)).toEqual(true); expect(annotation.hasFlag(AnnotationFlag.INVISIBLE)).toBeTrue();
expect(annotation.hasFlag(AnnotationFlag.NOZOOM)).toEqual(true); expect(annotation.hasFlag(AnnotationFlag.NOZOOM)).toBeTrue();
expect(annotation.hasFlag(AnnotationFlag.PRINT)).toEqual(true); expect(annotation.hasFlag(AnnotationFlag.PRINT)).toBeTrue();
expect(annotation.hasFlag(AnnotationFlag.READONLY)).toBeFalse(); expect(annotation.hasFlag(AnnotationFlag.READONLY)).toBeFalse();
expect(annotation.hasFlag(AnnotationFlag.HIDDEN)).toBeFalse(); expect(annotation.hasFlag(AnnotationFlag.HIDDEN)).toBeFalse();
}); });
@ -393,7 +393,7 @@ describe("annotation", function () {
evaluatorOptions: pdfManagerMock.evaluatorOptions, evaluatorOptions: pdfManagerMock.evaluatorOptions,
}); });
expect(annotation.viewable).toEqual(true); expect(annotation.viewable).toBeTrue();
expect(annotation.printable).toBeFalse(); expect(annotation.printable).toBeFalse();
}); });
@ -1060,7 +1060,7 @@ describe("annotation", function () {
expect(data.url).toBeUndefined(); expect(data.url).toBeUndefined();
expect(data.unsafeUrl).toEqual("../../0013/001346/134685E.pdf#4.3"); expect(data.unsafeUrl).toEqual("../../0013/001346/134685E.pdf#4.3");
expect(data.dest).toBeUndefined(); expect(data.dest).toBeUndefined();
expect(data.newWindow).toEqual(true); expect(data.newWindow).toBeTrue();
} }
); );
@ -1210,7 +1210,7 @@ describe("annotation", function () {
); );
expect(data.unsafeUrl).toEqual("Part II/Part II.pdf"); expect(data.unsafeUrl).toEqual("Part II/Part II.pdf");
expect(data.dest).toBeUndefined(); expect(data.dest).toBeUndefined();
expect(data.newWindow).toEqual(true); expect(data.newWindow).toBeTrue();
} }
); );
@ -1653,9 +1653,9 @@ describe("annotation", function () {
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
expect(data.textAlignment).toEqual(1); expect(data.textAlignment).toEqual(1);
expect(data.maxLen).toEqual(20); expect(data.maxLen).toEqual(20);
expect(data.readOnly).toEqual(true); expect(data.readOnly).toBeTrue();
expect(data.hidden).toBeFalse(); expect(data.hidden).toBeFalse();
expect(data.multiLine).toEqual(true); expect(data.multiLine).toBeTrue();
}); });
it("should reject comb fields without a maximum length", async function () { it("should reject comb fields without a maximum length", async function () {
@ -1688,7 +1688,7 @@ describe("annotation", function () {
idFactoryMock idFactoryMock
); );
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
expect(data.comb).toEqual(true); expect(data.comb).toBeTrue();
}); });
it("should only accept comb fields when the flags are valid", async function () { it("should only accept comb fields when the flags are valid", async function () {
@ -2560,7 +2560,7 @@ describe("annotation", function () {
idFactoryMock idFactoryMock
); );
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
expect(data.checkBox).toEqual(true); expect(data.checkBox).toBeTrue();
expect(data.fieldValue).toEqual("Checked"); expect(data.fieldValue).toEqual("Checked");
expect(data.defaultFieldValue).toEqual("Off"); expect(data.defaultFieldValue).toEqual("Off");
expect(data.radioButton).toBeFalse(); expect(data.radioButton).toBeFalse();
@ -2594,7 +2594,7 @@ describe("annotation", function () {
idFactoryMock idFactoryMock
); );
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
expect(data.checkBox).toEqual(true); expect(data.checkBox).toBeTrue();
expect(data.radioButton).toBeFalse(); expect(data.radioButton).toBeFalse();
expect(data.exportValue).toEqual("I Agree to terms"); expect(data.exportValue).toEqual("I Agree to terms");
expect(data.fieldValue).toEqual("I Agree to terms"); expect(data.fieldValue).toEqual("I Agree to terms");
@ -2634,7 +2634,7 @@ describe("annotation", function () {
idFactoryMock idFactoryMock
); );
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
expect(data.checkBox).toEqual(true); expect(data.checkBox).toBeTrue();
expect(data.radioButton).toBeFalse(); expect(data.radioButton).toBeFalse();
expect(data.exportValue).toEqual("I Agree to terms"); expect(data.exportValue).toEqual("I Agree to terms");
expect(data.fieldValue).toEqual("I Agree to terms"); expect(data.fieldValue).toEqual("I Agree to terms");
@ -2657,7 +2657,7 @@ describe("annotation", function () {
idFactoryMock idFactoryMock
); );
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
expect(data.checkBox).toEqual(true); expect(data.checkBox).toBeTrue();
expect(data.fieldValue).toEqual("Checked"); expect(data.fieldValue).toEqual("Checked");
expect(data.defaultFieldValue).toEqual("Off"); expect(data.defaultFieldValue).toEqual("Off");
expect(data.radioButton).toBeFalse(); expect(data.radioButton).toBeFalse();
@ -2686,7 +2686,7 @@ describe("annotation", function () {
idFactoryMock idFactoryMock
); );
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
expect(data.checkBox).toEqual(true); expect(data.checkBox).toBeTrue();
expect(data.fieldValue).toEqual("Checked"); expect(data.fieldValue).toEqual("Checked");
expect(data.defaultFieldValue).toEqual("Off"); expect(data.defaultFieldValue).toEqual("Off");
expect(data.radioButton).toBeFalse(); expect(data.radioButton).toBeFalse();
@ -2772,7 +2772,7 @@ describe("annotation", function () {
idFactoryMock idFactoryMock
); );
expect(annotation.data.checkBox).toEqual(true); expect(annotation.data.checkBox).toBeTrue();
expect(annotation.data.exportValue).toEqual("Checked"); expect(annotation.data.exportValue).toEqual("Checked");
const { opList } = await annotation.getOperatorList( const { opList } = await annotation.getOperatorList(
@ -2788,7 +2788,7 @@ describe("annotation", function () {
expect(opList.fnArray).toContain(OPS.showText); expect(opList.fnArray).toContain(OPS.showText);
const [id, , , , isUsingOwnCanvas, canvasName] = opList.argsArray[0]; const [id, , , , isUsingOwnCanvas, canvasName] = opList.argsArray[0];
expect(id).toEqual("124R"); expect(id).toEqual("124R");
expect(isUsingOwnCanvas).toEqual(true); expect(isUsingOwnCanvas).toBeTrue();
expect(canvasName).toEqual("checked"); expect(canvasName).toEqual("checked");
}); });
@ -3124,7 +3124,7 @@ describe("annotation", function () {
); );
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
expect(data.checkBox).toBeFalse(); expect(data.checkBox).toBeFalse();
expect(data.radioButton).toEqual(true); expect(data.radioButton).toBeTrue();
expect(data.fieldValue).toEqual("1"); expect(data.fieldValue).toEqual("1");
expect(data.buttonValue).toEqual("2"); expect(data.buttonValue).toEqual("2");
}); });
@ -3156,7 +3156,7 @@ describe("annotation", function () {
idFactoryMock idFactoryMock
); );
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
expect(data.radioButton).toEqual(true); expect(data.radioButton).toBeTrue();
// The field value (parent "V" = "1") and this widget's own on-state ("2") // The field value (parent "V" = "1") and this widget's own on-state ("2")
// are both mapped through "Opt" to their real export values. // are both mapped through "Opt" to their real export values.
expect(data.fieldValue).toEqual("Banane"); expect(data.fieldValue).toEqual("Banane");
@ -3190,7 +3190,7 @@ describe("annotation", function () {
idFactoryMock idFactoryMock
); );
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
expect(data.radioButton).toEqual(true); expect(data.radioButton).toBeTrue();
expect(data.fieldValue).toEqual("02"); expect(data.fieldValue).toEqual("02");
expect(data.buttonValue).toEqual("02"); expect(data.buttonValue).toEqual("02");
}); });
@ -3244,7 +3244,7 @@ describe("annotation", function () {
idFactoryMock idFactoryMock
); );
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
expect(data.radioButton).toEqual(true); expect(data.radioButton).toBeTrue();
expect(data.fieldValue).toEqual("Banane"); expect(data.fieldValue).toEqual("Banane");
expect(data.buttonValue).toEqual("Cherry"); expect(data.buttonValue).toEqual("Cherry");
}); });
@ -3277,7 +3277,7 @@ describe("annotation", function () {
); );
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
expect(data.checkBox).toBeFalse(); expect(data.checkBox).toBeFalse();
expect(data.radioButton).toEqual(true); expect(data.radioButton).toBeTrue();
expect(data.fieldValue).toEqual(name); expect(data.fieldValue).toEqual(name);
expect(data.buttonValue).toEqual(name); expect(data.buttonValue).toEqual(name);
}); });
@ -3305,7 +3305,7 @@ describe("annotation", function () {
); );
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
expect(data.checkBox).toBeFalse(); expect(data.checkBox).toBeFalse();
expect(data.radioButton).toEqual(true); expect(data.radioButton).toBeTrue();
expect(data.fieldValue).toBeNull(); expect(data.fieldValue).toBeNull();
expect(data.buttonValue).toEqual("2"); expect(data.buttonValue).toEqual("2");
}); });
@ -3727,7 +3727,7 @@ describe("annotation", function () {
idFactoryMock idFactoryMock
); );
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
expect(data.pushButton).toEqual(true); expect(data.pushButton).toBeTrue();
expect(data.actions.Action).toEqual(["do_something();"]); expect(data.actions.Action).toEqual(["do_something();"]);
}); });
@ -3747,7 +3747,7 @@ describe("annotation", function () {
idFactoryMock idFactoryMock
); );
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
expect(data.pushButton).toEqual(true); expect(data.pushButton).toBeTrue();
expect(data.alternativeText).toEqual("An alternative text"); expect(data.alternativeText).toEqual("An alternative text");
}); });
@ -4055,10 +4055,10 @@ describe("annotation", function () {
idFactoryMock idFactoryMock
); );
expect(data.annotationType).toEqual(AnnotationType.WIDGET); expect(data.annotationType).toEqual(AnnotationType.WIDGET);
expect(data.readOnly).toEqual(true); expect(data.readOnly).toBeTrue();
expect(data.hidden).toBeFalse(); expect(data.hidden).toBeFalse();
expect(data.combo).toEqual(true); expect(data.combo).toBeTrue();
expect(data.multiSelect).toEqual(true); expect(data.multiSelect).toBeTrue();
}); });
it("should render choice for printing", async function () { it("should render choice for printing", async function () {
@ -4834,7 +4834,7 @@ describe("annotation", function () {
idFactoryMock idFactoryMock
); );
expect(data.annotationType).toEqual(AnnotationType.RICHMEDIA); expect(data.annotationType).toEqual(AnnotationType.RICHMEDIA);
expect(data.noHTML).toEqual(true); expect(data.noHTML).toBeTrue();
expect(data.richMedia).toBeUndefined(); expect(data.richMedia).toBeUndefined();
}); });
@ -4906,7 +4906,7 @@ describe("annotation", function () {
idFactoryMock idFactoryMock
); );
expect(data.annotationType).toEqual(AnnotationType.RICHMEDIA); expect(data.annotationType).toEqual(AnnotationType.RICHMEDIA);
expect(data.noHTML).toEqual(true); expect(data.noHTML).toBeTrue();
expect(data.richMedia).toBeUndefined(); expect(data.richMedia).toBeUndefined();
}); });
@ -4943,7 +4943,7 @@ describe("annotation", function () {
idFactoryMock idFactoryMock
); );
expect(data.annotationType).toEqual(AnnotationType.RICHMEDIA); expect(data.annotationType).toEqual(AnnotationType.RICHMEDIA);
expect(data.noHTML).toEqual(true); expect(data.noHTML).toBeTrue();
expect(data.richMedia).toBeUndefined(); expect(data.richMedia).toBeUndefined();
}); });
}); });
@ -5185,7 +5185,7 @@ describe("annotation", function () {
idFactoryMock idFactoryMock
); );
expect(data.annotationType).toEqual(AnnotationType.SCREEN); expect(data.annotationType).toEqual(AnnotationType.SCREEN);
expect(data.noHTML).toEqual(true); expect(data.noHTML).toBeTrue();
expect(data.richMedia).toBeUndefined(); expect(data.richMedia).toBeUndefined();
}); });
@ -5216,7 +5216,7 @@ describe("annotation", function () {
idFactoryMock idFactoryMock
); );
expect(data.annotationType).toEqual(AnnotationType.SCREEN); expect(data.annotationType).toEqual(AnnotationType.SCREEN);
expect(data.noHTML).toEqual(true); expect(data.noHTML).toBeTrue();
expect(data.richMedia).toBeUndefined(); expect(data.richMedia).toBeUndefined();
}); });
@ -5236,7 +5236,7 @@ describe("annotation", function () {
idFactoryMock idFactoryMock
); );
expect(data.annotationType).toEqual(AnnotationType.SCREEN); expect(data.annotationType).toEqual(AnnotationType.SCREEN);
expect(data.noHTML).toEqual(true); expect(data.noHTML).toBeTrue();
expect(data.richMedia).toBeUndefined(); expect(data.richMedia).toBeUndefined();
}); });
}); });
@ -5300,7 +5300,7 @@ describe("annotation", function () {
idFactoryMock idFactoryMock
); );
expect(data.annotationType).toEqual(AnnotationType.SOUND); expect(data.annotationType).toEqual(AnnotationType.SOUND);
expect(data.noHTML).toEqual(true); expect(data.noHTML).toBeTrue();
expect(data.richMedia).toBeUndefined(); expect(data.richMedia).toBeUndefined();
}); });
@ -5324,7 +5324,7 @@ describe("annotation", function () {
idFactoryMock idFactoryMock
); );
expect(data.annotationType).toEqual(AnnotationType.SOUND); expect(data.annotationType).toEqual(AnnotationType.SOUND);
expect(data.noHTML).toEqual(true); expect(data.noHTML).toBeTrue();
expect(data.richMedia).toBeUndefined(); expect(data.richMedia).toBeUndefined();
}); });
@ -5339,7 +5339,7 @@ describe("annotation", function () {
idFactoryMock idFactoryMock
); );
expect(data.annotationType).toEqual(AnnotationType.SOUND); expect(data.annotationType).toEqual(AnnotationType.SOUND);
expect(data.noHTML).toEqual(true); expect(data.noHTML).toBeTrue();
expect(data.richMedia).toBeUndefined(); expect(data.richMedia).toBeUndefined();
}); });
@ -5366,7 +5366,7 @@ describe("annotation", function () {
try { try {
catalog.attachmentContent(soundId); catalog.attachmentContent(soundId);
expect(false).toEqual(true); expect(false).toBeTrue();
} catch (ex) { } catch (ex) {
expect(ex).toBeInstanceOf(PasswordException); expect(ex).toBeInstanceOf(PasswordException);
expect(ex.code).toEqual(PasswordResponses.NEED_PASSWORD); expect(ex.code).toEqual(PasswordResponses.NEED_PASSWORD);
@ -5454,7 +5454,7 @@ describe("annotation", function () {
// e.g., the API. // e.g., the API.
expect(data.annotationFlags).toEqual(56); expect(data.annotationFlags).toEqual(56);
// The popup should inherit the `viewable` property of the parent. // The popup should inherit the `viewable` property of the parent.
expect(viewable).toEqual(true); expect(viewable).toBeTrue();
} }
); );

View File

@ -72,11 +72,11 @@ describe("AnnotationStorage", function () {
annotationStorage.onSetModified = callback; annotationStorage.onSetModified = callback;
annotationStorage.setValue("asdf", { value: "original" }); annotationStorage.setValue("asdf", { value: "original" });
expect(called).toBe(true); expect(called).toBeTrue();
// changing value // changing value
annotationStorage.setValue("asdf", { value: "modified" }); annotationStorage.setValue("asdf", { value: "modified" });
expect(called).toBe(true); expect(called).toBeTrue();
// not changing value // not changing value
called = false; called = false;
@ -95,7 +95,7 @@ describe("AnnotationStorage", function () {
annotationStorage.onResetModified = callback; annotationStorage.onResetModified = callback;
annotationStorage.setValue("asdf", { value: "original" }); annotationStorage.setValue("asdf", { value: "original" });
annotationStorage.resetModified(); annotationStorage.resetModified();
expect(called).toBe(true); expect(called).toBeTrue();
called = false; called = false;
// not changing value // not changing value
@ -106,7 +106,7 @@ describe("AnnotationStorage", function () {
// changing value // changing value
annotationStorage.setValue("asdf", { value: "modified" }); annotationStorage.setValue("asdf", { value: "modified" });
annotationStorage.resetModified(); annotationStorage.resetModified();
expect(called).toBe(true); expect(called).toBeTrue();
}); });
}); });
}); });

View File

@ -261,9 +261,9 @@ describe("api", function () {
await loadingTask.promise; await loadingTask.promise;
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
} catch { } catch {
expect(true).toEqual(true); expect(true).toBeTrue();
await destroyed; await destroyed;
} }
}); });
@ -394,7 +394,7 @@ describe("api", function () {
await loadingTask.promise; await loadingTask.promise;
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
} catch (reason) { } catch (reason) {
expect(reason).toBeInstanceOf(InvalidPDFException); expect(reason).toBeInstanceOf(InvalidPDFException);
expect(reason.message).toEqual("Invalid PDF structure."); expect(reason.message).toEqual("Invalid PDF structure.");
@ -413,11 +413,11 @@ describe("api", function () {
await loadingTask.promise; await loadingTask.promise;
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
} catch (reason) { } catch (reason) {
expect(reason).toBeInstanceOf(ResponseException); expect(reason).toBeInstanceOf(ResponseException);
expect(reason.status).toEqual(isNodeJS ? 0 : 404); expect(reason.status).toEqual(isNodeJS ? 0 : 404);
expect(reason.missing).toEqual(true); expect(reason.missing).toBeTrue();
} }
await loadingTask.destroy(); await loadingTask.destroy();
@ -459,7 +459,7 @@ describe("api", function () {
return; return;
} }
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
}; };
const data = await Promise.all([ const data = await Promise.all([
@ -485,7 +485,7 @@ describe("api", function () {
const result1 = passwordNeededLoadingTask.promise.then( const result1 = passwordNeededLoadingTask.promise.then(
function () { function () {
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
throw new Error("loadingTask should be rejected"); throw new Error("loadingTask should be rejected");
}, },
function (data) { function (data) {
@ -507,7 +507,7 @@ describe("api", function () {
const result2 = passwordIncorrectLoadingTask.promise.then( const result2 = passwordIncorrectLoadingTask.promise.then(
function () { function () {
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
throw new Error("loadingTask should be rejected"); throw new Error("loadingTask should be rejected");
}, },
function (data) { function (data) {
@ -563,12 +563,12 @@ describe("api", function () {
return; return;
} }
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
}; };
const result1 = passwordNeededLoadingTask.promise.then( const result1 = passwordNeededLoadingTask.promise.then(
function () { function () {
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
throw new Error("loadingTask should be rejected"); throw new Error("loadingTask should be rejected");
}, },
function (reason) { function (reason) {
@ -583,12 +583,12 @@ describe("api", function () {
throw new Error("Incorrect password"); throw new Error("Incorrect password");
} }
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
}; };
const result2 = passwordIncorrectLoadingTask.promise.then( const result2 = passwordIncorrectLoadingTask.promise.then(
function () { function () {
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
throw new Error("loadingTask should be rejected"); throw new Error("loadingTask should be rejected");
}, },
function (reason) { function (reason) {
@ -622,7 +622,7 @@ describe("api", function () {
await loadingTask.promise.then( await loadingTask.promise.then(
function () { function () {
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
}, },
function (reason) { function (reason) {
expect(reason).toBeInstanceOf(PasswordException); expect(reason).toBeInstanceOf(PasswordException);
@ -642,7 +642,7 @@ describe("api", function () {
await loadingTask.promise; await loadingTask.promise;
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
} catch (reason) { } catch (reason) {
expect(reason).toBeInstanceOf(InvalidPDFException); expect(reason).toBeInstanceOf(InvalidPDFException);
expect(reason.message).toEqual( expect(reason.message).toEqual(
@ -705,7 +705,7 @@ describe("api", function () {
const opList = await page.getOperatorList(); const opList = await page.getOperatorList();
expect(opList.fnArray.length).toEqual(0); expect(opList.fnArray.length).toEqual(0);
expect(opList.argsArray.length).toEqual(0); expect(opList.argsArray.length).toEqual(0);
expect(opList.lastChunk).toEqual(true); expect(opList.lastChunk).toBeTrue();
expect(opList.separateAnnots).toBeNull(); expect(opList.separateAnnots).toBeNull();
await loadingTask.destroy(); await loadingTask.destroy();
@ -726,7 +726,7 @@ describe("api", function () {
const opList = await page.getOperatorList(); const opList = await page.getOperatorList();
expect(opList.fnArray.length).toEqual(0); expect(opList.fnArray.length).toEqual(0);
expect(opList.argsArray.length).toEqual(0); expect(opList.argsArray.length).toEqual(0);
expect(opList.lastChunk).toEqual(true); expect(opList.lastChunk).toBeTrue();
expect(opList.separateAnnots).toBeNull(); expect(opList.separateAnnots).toBeNull();
await loadingTask.destroy(); await loadingTask.destroy();
@ -743,7 +743,7 @@ describe("api", function () {
await loadingTask.promise; await loadingTask.promise;
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
} catch (reason) { } catch (reason) {
expect(reason).toBeInstanceOf(InvalidPDFException); expect(reason).toBeInstanceOf(InvalidPDFException);
expect(reason.message).toEqual("Invalid Root reference."); expect(reason.message).toEqual("Invalid Root reference.");
@ -762,7 +762,7 @@ describe("api", function () {
await loadingTask.promise; await loadingTask.promise;
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
} catch (reason) { } catch (reason) {
expect(reason).toBeInstanceOf(InvalidPDFException); expect(reason).toBeInstanceOf(InvalidPDFException);
expect(reason.message).toEqual("Invalid Root reference."); expect(reason.message).toEqual("Invalid Root reference.");
@ -800,7 +800,7 @@ describe("api", function () {
const opListA = await pageA.getOperatorList(); const opListA = await pageA.getOperatorList();
expect(opListA.fnArray.length).toBeGreaterThan(5); expect(opListA.fnArray.length).toBeGreaterThan(5);
expect(opListA.argsArray.length).toBeGreaterThan(5); expect(opListA.argsArray.length).toBeGreaterThan(5);
expect(opListA.lastChunk).toEqual(true); expect(opListA.lastChunk).toBeTrue();
expect(opListA.separateAnnots).toBeNull(); expect(opListA.separateAnnots).toBeNull();
const pageB = await pdfDocument2.getPage(1); const pageB = await pdfDocument2.getPage(1);
@ -809,14 +809,14 @@ describe("api", function () {
const opListB = await pageB.getOperatorList(); const opListB = await pageB.getOperatorList();
expect(opListB.fnArray.length).toBe(0); expect(opListB.fnArray.length).toBe(0);
expect(opListB.argsArray.length).toBe(0); expect(opListB.argsArray.length).toBe(0);
expect(opListB.lastChunk).toEqual(true); expect(opListB.lastChunk).toBeTrue();
expect(opListB.separateAnnots).toBeNull(); expect(opListB.separateAnnots).toBeNull();
try { try {
await pdfDocument3.getPage(1); await pdfDocument3.getPage(1);
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
} catch (reason) { } catch (reason) {
expect(reason).toBeInstanceOf(UnknownErrorException); expect(reason).toBeInstanceOf(UnknownErrorException);
expect(reason.message).toEqual("Bad (uncompressed) XRef entry: 3R"); expect(reason.message).toEqual("Bad (uncompressed) XRef entry: 3R");
@ -850,7 +850,7 @@ describe("api", function () {
const opListA = await pageA.getOperatorList(); const opListA = await pageA.getOperatorList();
expect(opListA.fnArray.length).toEqual(19); expect(opListA.fnArray.length).toEqual(19);
expect(opListA.argsArray.length).toEqual(19); expect(opListA.argsArray.length).toEqual(19);
expect(opListA.lastChunk).toEqual(true); expect(opListA.lastChunk).toBeTrue();
expect(opListA.separateAnnots).toBeNull(); expect(opListA.separateAnnots).toBeNull();
const pageB = await pdfDocument2.getPage(1); const pageB = await pdfDocument2.getPage(1);
@ -859,7 +859,7 @@ describe("api", function () {
const opListB = await pageB.getOperatorList(); const opListB = await pageB.getOperatorList();
expect(opListB.fnArray.length).toEqual(1); expect(opListB.fnArray.length).toEqual(1);
expect(opListB.argsArray.length).toEqual(1); expect(opListB.argsArray.length).toEqual(1);
expect(opListB.lastChunk).toEqual(true); expect(opListB.lastChunk).toBeTrue();
expect(opListB.separateAnnots).toBeNull(); expect(opListB.separateAnnots).toBeNull();
await Promise.all([loadingTask1.destroy(), loadingTask2.destroy()]); await Promise.all([loadingTask1.destroy(), loadingTask2.destroy()]);
@ -893,7 +893,7 @@ describe("api", function () {
]) { ]) {
expect(opList.fnArray.length).toBeGreaterThan(5); expect(opList.fnArray.length).toBeGreaterThan(5);
expect(opList.argsArray.length).toBeGreaterThan(5); expect(opList.argsArray.length).toBeGreaterThan(5);
expect(opList.lastChunk).toEqual(true); expect(opList.lastChunk).toBeTrue();
expect(opList.separateAnnots).toBeNull(); expect(opList.separateAnnots).toBeNull();
} }
@ -920,7 +920,7 @@ describe("api", function () {
await pdfDocument1.getPage(1); await pdfDocument1.getPage(1);
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
} catch (reason) { } catch (reason) {
expect(reason).toBeInstanceOf(UnknownErrorException); expect(reason).toBeInstanceOf(UnknownErrorException);
expect(reason.message).toEqual("Illegal character: 41"); expect(reason.message).toEqual("Illegal character: 41");
@ -929,7 +929,7 @@ describe("api", function () {
await pdfDocument2.getPage(1); await pdfDocument2.getPage(1);
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
} catch (reason) { } catch (reason) {
expect(reason).toBeInstanceOf(UnknownErrorException); expect(reason).toBeInstanceOf(UnknownErrorException);
expect(reason.message).toEqual("End of file inside array."); expect(reason.message).toEqual("End of file inside array.");
@ -973,7 +973,7 @@ describe("api", function () {
new Float32Array([0, 9.75, 0.5, 9.75]), new Float32Array([0, 9.75, 0.5, 9.75]),
], ],
]); ]);
expect(opList.lastChunk).toEqual(true); expect(opList.lastChunk).toBeTrue();
await loadingTask.destroy(); await loadingTask.destroy();
}); });
@ -1021,7 +1021,7 @@ describe("api", function () {
await loadingTask.promise; await loadingTask.promise;
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
} catch (ex) { } catch (ex) {
expect(ex).toBeInstanceOf(PasswordException); expect(ex).toBeInstanceOf(PasswordException);
expect(ex.code).toEqual(PasswordResponses.NEED_PASSWORD); expect(ex.code).toEqual(PasswordResponses.NEED_PASSWORD);
@ -1061,14 +1061,14 @@ describe("api", function () {
const worker = new PDFWorker({ name: "test1" }); const worker = new PDFWorker({ name: "test1" });
await worker.promise; await worker.promise;
expect(worker.name).toEqual("test1"); expect(worker.name).toEqual("test1");
expect(!!worker.port).toEqual(true); expect(!!worker.port).toBeTrue();
expect(worker.destroyed).toBeFalse(); expect(worker.destroyed).toBeFalse();
expect(!!worker._webWorker).toEqual(true); expect(!!worker._webWorker).toBeTrue();
expect(worker.port === worker._webWorker).toEqual(true); expect(worker.port === worker._webWorker).toBeTrue();
worker.destroy(); worker.destroy();
expect(!!worker.port).toBeFalse(); expect(!!worker.port).toBeFalse();
expect(worker.destroyed).toEqual(true); expect(worker.destroyed).toBeTrue();
}); });
it("worker created or destroyed by getDocument", async function () { it("worker created or destroyed by getDocument", async function () {
@ -1080,7 +1080,7 @@ describe("api", function () {
let worker; let worker;
loadingTask.promise.then(function () { loadingTask.promise.then(function () {
worker = loadingTask._worker; worker = loadingTask._worker;
expect(!!worker).toEqual(true); expect(!!worker).toBeTrue();
}); });
const destroyPromise = loadingTask.promise.then(() => const destroyPromise = loadingTask.promise.then(() =>
@ -1090,7 +1090,7 @@ describe("api", function () {
const destroyedWorker = loadingTask._worker; const destroyedWorker = loadingTask._worker;
expect(!!destroyedWorker).toBeFalse(); expect(!!destroyedWorker).toBeFalse();
expect(worker.destroyed).toEqual(true); expect(worker.destroyed).toBeTrue();
}); });
it("worker created and can be used in getDocument", async function () { it("worker created and can be used in getDocument", async function () {
@ -1109,7 +1109,7 @@ describe("api", function () {
expect(!!docWorker).toBeFalse(); expect(!!docWorker).toBeFalse();
// checking is the same port is used in the MessageHandler // checking is the same port is used in the MessageHandler
const messageHandlerPort = loadingTask._transport.messageHandler.comObj; const messageHandlerPort = loadingTask._transport.messageHandler.comObj;
expect(messageHandlerPort === worker.port).toEqual(true); expect(messageHandlerPort === worker.port).toBeTrue();
}); });
const destroyPromise = loadingTask.promise.then(() => const destroyPromise = loadingTask.promise.then(() =>
@ -1135,7 +1135,7 @@ describe("api", function () {
worker1.port !== worker2.port && worker1.port !== worker2.port &&
worker1.port !== worker3.port && worker1.port !== worker3.port &&
worker2.port !== worker3.port worker2.port !== worker3.port
).toEqual(true); ).toBeTrue();
worker1.destroy(); worker1.destroy();
worker2.destroy(); worker2.destroy();
worker3.destroy(); worker3.destroy();
@ -1166,7 +1166,7 @@ describe("api", function () {
"https://www.mozilla.org/foo", "https://www.mozilla.org/foo",
"https://www.mozilla.org/bar" "https://www.mozilla.org/bar"
) )
).toEqual(true); ).toBeTrue();
expect( expect(
PDFWorker._isSameOrigin( PDFWorker._isSameOrigin(
"https://www.mozilla.org/foo", "https://www.mozilla.org/foo",
@ -1350,7 +1350,7 @@ describe("api", function () {
await pdfDocument.getPage(pageNumber); await pdfDocument.getPage(pageNumber);
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
} catch (reason) { } catch (reason) {
expect(reason).toBeInstanceOf(Error); expect(reason).toBeInstanceOf(Error);
expect(reason.message).toEqual("Invalid page request."); expect(reason.message).toEqual("Invalid page request.");
@ -1452,7 +1452,7 @@ describe("api", function () {
await pdfDocument.getPageIndex(pageRefs[i]); await pdfDocument.getPageIndex(pageRefs[i]);
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
} catch (reason) { } catch (reason) {
const { exception, message } = expectedErrors[i]; const { exception, message } = expectedErrors[i];
@ -1966,7 +1966,7 @@ describe("api", function () {
const pdfDoc = await loadingTask.promise; const pdfDoc = await loadingTask.promise;
const hasJSActions = await pdfDoc.hasJSActions(); const hasJSActions = await pdfDoc.hasJSActions();
expect(hasJSActions).toEqual(true); expect(hasJSActions).toBeTrue();
await loadingTask.destroy(); await loadingTask.destroy();
}); });
@ -2318,18 +2318,18 @@ describe("api", function () {
const outline = await pdfDocument.getOutline(); const outline = await pdfDocument.getOutline();
// Two top level entries. // Two top level entries.
expect(Array.isArray(outline)).toEqual(true); expect(Array.isArray(outline)).toBeTrue();
expect(outline.length).toEqual(2); expect(outline.length).toEqual(2);
// Make sure some basic attributes are set. // Make sure some basic attributes are set.
const outlineItem = outline[1]; const outlineItem = outline[1];
expect(outlineItem.title).toEqual("Chapter 1"); expect(outlineItem.title).toEqual("Chapter 1");
expect(Array.isArray(outlineItem.dest)).toEqual(true); expect(Array.isArray(outlineItem.dest)).toBeTrue();
expect(outlineItem.url).toBeNull(); expect(outlineItem.url).toBeNull();
expect(outlineItem.unsafeUrl).toBeUndefined(); expect(outlineItem.unsafeUrl).toBeUndefined();
expect(outlineItem.newWindow).toBeUndefined(); expect(outlineItem.newWindow).toBeUndefined();
expect(outlineItem.bold).toEqual(true); expect(outlineItem.bold).toBeTrue();
expect(outlineItem.italic).toBeFalse(); expect(outlineItem.italic).toBeFalse();
expect(outlineItem.color).toEqual(new Uint8ClampedArray([0, 64, 128])); expect(outlineItem.color).toEqual(new Uint8ClampedArray([0, 64, 128]));
@ -2341,7 +2341,7 @@ describe("api", function () {
const loadingTask = getDocument(buildGetDocumentParams("issue3214.pdf")); const loadingTask = getDocument(buildGetDocumentParams("issue3214.pdf"));
const pdfDoc = await loadingTask.promise; const pdfDoc = await loadingTask.promise;
const outline = await pdfDoc.getOutline(); const outline = await pdfDoc.getOutline();
expect(Array.isArray(outline)).toEqual(true); expect(Array.isArray(outline)).toBeTrue();
expect(outline.length).toEqual(5); expect(outline.length).toEqual(5);
const outlineItemTwo = outline[2]; const outlineItemTwo = outline[2];
@ -2353,7 +2353,7 @@ describe("api", function () {
const outlineItemOne = outline[1]; const outlineItemOne = outline[1];
expect(outlineItemOne.bold).toBeFalse(); expect(outlineItemOne.bold).toBeFalse();
expect(outlineItemOne.italic).toEqual(true); expect(outlineItemOne.italic).toBeTrue();
expect(outlineItemOne.color).toEqual(new Uint8ClampedArray([0, 0, 0])); expect(outlineItemOne.color).toEqual(new Uint8ClampedArray([0, 0, 0]));
await loadingTask.destroy(); await loadingTask.destroy();
@ -2364,7 +2364,7 @@ describe("api", function () {
const pdfDoc = await loadingTask.promise; const pdfDoc = await loadingTask.promise;
const outline = await pdfDoc.getOutline(); const outline = await pdfDoc.getOutline();
expect(Array.isArray(outline)).toEqual(true); expect(Array.isArray(outline)).toBeTrue();
expect(outline.length).toEqual(9); expect(outline.length).toEqual(9);
expect(outline[0]).toEqual({ expect(outline[0]).toEqual({
@ -2392,7 +2392,7 @@ describe("api", function () {
const pdfDoc = await loadingTask.promise; const pdfDoc = await loadingTask.promise;
const outline = await pdfDoc.getOutline(); const outline = await pdfDoc.getOutline();
expect(Array.isArray(outline)).toEqual(true); expect(Array.isArray(outline)).toBeTrue();
expect(outline.length).toEqual(6); expect(outline.length).toEqual(6);
expect(outline[4]).toEqual({ expect(outline[4]).toEqual({
@ -2420,7 +2420,7 @@ describe("api", function () {
const pdfDoc = await loadingTask.promise; const pdfDoc = await loadingTask.promise;
const outline = await pdfDoc.getOutline(); const outline = await pdfDoc.getOutline();
expect(Array.isArray(outline)).toEqual(true); expect(Array.isArray(outline)).toBeTrue();
expect(outline.length).toEqual(4); expect(outline.length).toEqual(4);
expect(outline[1]).toEqual({ expect(outline[1]).toEqual({
@ -2448,7 +2448,7 @@ describe("api", function () {
const pdfDoc = await loadingTask.promise; const pdfDoc = await loadingTask.promise;
const outline = await pdfDoc.getOutline(); const outline = await pdfDoc.getOutline();
expect(Array.isArray(outline)).toEqual(true); expect(Array.isArray(outline)).toBeTrue();
expect(outline.length).toEqual(1); expect(outline.length).toEqual(1);
expect(outline[0]).toEqual({ expect(outline[0]).toEqual({
@ -2475,7 +2475,7 @@ describe("api", function () {
const loadingTask = getDocument(buildGetDocumentParams("issue14267.pdf")); const loadingTask = getDocument(buildGetDocumentParams("issue14267.pdf"));
const pdfDoc = await loadingTask.promise; const pdfDoc = await loadingTask.promise;
const outline = await pdfDoc.getOutline(); const outline = await pdfDoc.getOutline();
expect(Array.isArray(outline)).toEqual(true); expect(Array.isArray(outline)).toBeTrue();
expect(outline.length).toEqual(1); expect(outline.length).toEqual(1);
const outlineItem = outline[0]; const outlineItem = outline[0];
@ -2725,7 +2725,7 @@ describe("api", function () {
expect(info.CreationDate).toEqual("D:20090401163925-07'00'"); expect(info.CreationDate).toEqual("D:20090401163925-07'00'");
// Custom, non-standard, information dictionary entries. // Custom, non-standard, information dictionary entries.
const custom = info.Custom; const custom = info.Custom;
expect(typeof custom === "object" && custom !== null).toEqual(true); expect(typeof custom === "object" && custom !== null).toBeTrue();
expect(custom["PTEX.Fullbanner"]).toEqual( expect(custom["PTEX.Fullbanner"]).toEqual(
"This is pdfeTeX, " + "This is pdfeTeX, " +
@ -2788,7 +2788,7 @@ describe("api", function () {
expect(info.Language).toBeNull(); expect(info.Language).toBeNull();
expect(info.EncryptFilterName).toBeNull(); expect(info.EncryptFilterName).toBeNull();
expect(info.IsLinearized).toBeFalse(); expect(info.IsLinearized).toBeFalse();
expect(info.IsAcroFormPresent).toEqual(true); expect(info.IsAcroFormPresent).toBeTrue();
expect(info.IsXFAPresent).toBeFalse(); expect(info.IsXFAPresent).toBeFalse();
expect(info.IsCollectionPresent).toBeFalse(); expect(info.IsCollectionPresent).toBeFalse();
expect(info.IsSignaturesPresent).toBeFalse(); expect(info.IsSignaturesPresent).toBeFalse();
@ -2807,7 +2807,7 @@ describe("api", function () {
const pdfDoc = await loadingTask.promise; const pdfDoc = await loadingTask.promise;
const markInfo = await pdfDoc.getMarkInfo(); const markInfo = await pdfDoc.getMarkInfo();
expect(markInfo.Marked).toEqual(true); expect(markInfo.Marked).toBeTrue();
expect(markInfo.UserProperties).toBeFalse(); expect(markInfo.UserProperties).toBeFalse();
expect(markInfo.Suspects).toBeFalse(); expect(markInfo.Suspects).toBeFalse();
@ -2851,7 +2851,7 @@ describe("api", function () {
it("cleans up document resources", async function () { it("cleans up document resources", async function () {
await pdfDocument.cleanup(); await pdfDocument.cleanup();
expect(true).toEqual(true); expect(true).toBeTrue();
}); });
it("checks that fingerprints are unique", async function () { it("checks that fingerprints are unique", async function () {
@ -2901,7 +2901,7 @@ describe("api", function () {
const annotations = await pdfPage.getAnnotations(); const annotations = await pdfPage.getAnnotations();
const field = annotations.find(annotation => annotation.id === "55R"); const field = annotations.find(annotation => annotation.id === "55R");
expect(!!field).toEqual(true); expect(!!field).toBeTrue();
expect(field.fieldValue).toEqual(value); expect(field.fieldValue).toEqual(value);
await loadingTask.destroy(); await loadingTask.destroy();
@ -3613,7 +3613,7 @@ describe("api", function () {
const annotations = await pdfPage.getAnnotations(); const annotations = await pdfPage.getAnnotations();
const field = annotations.find(annotation => annotation.id === "144R"); const field = annotations.find(annotation => annotation.id === "144R");
expect(!!field).toEqual(true); expect(!!field).toBeTrue();
expect(field.fieldValue).toEqual("Several\n\nOther\nJobs"); expect(field.fieldValue).toEqual("Several\n\nOther\nJobs");
expect(field.textContent).toEqual(["Several", "", "Other", "Jobs"]); expect(field.textContent).toEqual(["Several", "", "Other", "Jobs"]);
@ -3638,7 +3638,7 @@ describe("api", function () {
.then(() => loadingTask.destroy()) .then(() => loadingTask.destroy())
.then( .then(
function () { function () {
expect(expectSuccess).toEqual(true); expect(expectSuccess).toBeTrue();
}, },
function (error) { function (error) {
if (expectSuccess) { if (expectSuccess) {
@ -4099,7 +4099,7 @@ describe("api", function () {
a => a.annotationType === AnnotationType.FILEATTACHMENT a => a.annotationType === AnnotationType.FILEATTACHMENT
); );
const { fileId } = fileAnnotation; const { fileId } = fileAnnotation;
expect(fileId.startsWith("attachmentRef:")).toEqual(true); expect(fileId.startsWith("attachmentRef:")).toBeTrue();
const before = await pdfDoc.getAttachmentContent(fileId); const before = await pdfDoc.getAttachmentContent(fileId);
expect(before).toBeInstanceOf(Uint8Array); expect(before).toBeInstanceOf(Uint8Array);
@ -4129,7 +4129,7 @@ describe("api", function () {
expect(unsafeUrl).toEqual( expect(unsafeUrl).toEqual(
"对不起/没关系/1_1_模块1行政文件和药品信息目录.pdf" "对不起/没关系/1_1_模块1行政文件和药品信息目录.pdf"
); );
expect(newWindow).toEqual(true); expect(newWindow).toBeTrue();
await loadingTask.destroy(); await loadingTask.destroy();
}); });
@ -4200,7 +4200,7 @@ page 1 / 3`);
// `commonObjs` property being populated below. // `commonObjs` property being populated below.
canvasFactory.destroy(canvasAndCtx); canvasFactory.destroy(canvasAndCtx);
expect(pdfPage.commonObjs.has(fontName)).toEqual(true); expect(pdfPage.commonObjs.has(fontName)).toBeTrue();
await loadingTask.destroy(); await loadingTask.destroy();
}); });
@ -4234,7 +4234,7 @@ page 1 / 3`);
text.includes( text.includes(
"Engang var der i Samvirke en opskrift på en fiskelagkage, som jeg med" "Engang var der i Samvirke en opskrift på en fiskelagkage, som jeg med"
) )
).toBe(true); ).toBeTrue();
await loadingTask.destroy(); await loadingTask.destroy();
}); });
@ -4252,17 +4252,17 @@ page 1 / 3`);
text.includes( text.includes(
"Abstract. A purely peer-to-peer version of electronic cash would allow online" "Abstract. A purely peer-to-peer version of electronic cash would allow online"
) )
).toEqual(true); ).toBeTrue();
expect( expect(
text.includes( text.includes(
"avoid mediating disputes. The cost of mediation increases transaction costs, limiting the" "avoid mediating disputes. The cost of mediation increases transaction costs, limiting the"
) )
).toEqual(true); ).toBeTrue();
expect( expect(
text.includes( text.includes(
"system is secure as long as honest nodes collectively control more CPU power than any" "system is secure as long as honest nodes collectively control more CPU power than any"
) )
).toEqual(true); ).toBeTrue();
await loadingTask.destroy(); await loadingTask.destroy();
}); });
@ -4280,12 +4280,12 @@ page 1 / 3`);
text.includes( text.includes(
"1. The first of these cases arises from the tragic handicap which has blighted the life of the Plaintiff, and from the response of the" "1. The first of these cases arises from the tragic handicap which has blighted the life of the Plaintiff, and from the response of the"
) )
).toEqual(true); ).toBeTrue();
expect( expect(
text.includes( text.includes(
"argued in this Court the appeal raises narrower, but important, issues which may be summarised as follows:-" "argued in this Court the appeal raises narrower, but important, issues which may be summarised as follows:-"
) )
).toEqual(true); ).toBeTrue();
await loadingTask.destroy(); await loadingTask.destroy();
}); });
@ -4305,7 +4305,7 @@ page 1 / 3`);
1,485.1 1,582.7 1,629.2 1,633.7 1,485.1 1,582.7 1,629.2 1,633.7
114.2 121.7 125.3 130.7 114.2 121.7 125.3 130.7
13.0x 13.0x 13.0x 12.5x`) 13.0x 13.0x 13.0x 12.5x`)
).toEqual(true); ).toBeTrue();
await loadingTask.destroy(); await loadingTask.destroy();
}); });
@ -4328,7 +4328,7 @@ This package provides support for this font in LATEX. It includes Type \x81
versions of the fonts, converted for this package using FontForge from its versions of the fonts, converted for this package using FontForge from its
sources, for full support with Dvips.`; sources, for full support with Dvips.`;
expect(text.includes(expected)).toEqual(true); expect(text.includes(expected)).toBeTrue();
({ items } = await pdfPage.getTextContent({ ({ items } = await pdfPage.getTextContent({
disableNormalization: false, disableNormalization: false,
@ -4343,7 +4343,7 @@ Directory [\x81] as TrueType files licensed under the Apache License version \x8
This package provides support for this font in LATEX. It includes Type \x81 This package provides support for this font in LATEX. It includes Type \x81
versions of the fonts, converted for this package using FontForge from its versions of the fonts, converted for this package using FontForge from its
sources, for full support with Dvips.`; sources, for full support with Dvips.`;
expect(text.includes(expected)).toEqual(true); expect(text.includes(expected)).toBeTrue();
await loadingTask.destroy(); await loadingTask.destroy();
}); });
@ -4369,7 +4369,7 @@ Innovationsabteilung. Seit 2009 ist sie Frank Stronachs Büroleiterin in Österr
Kanada. Zusätzlich ist sie seit 2012 Vice President, Business Development der Kanada. Zusätzlich ist sie seit 2012 Vice President, Business Development der
Stronach Group und Vizepräsidentin und Institutsleiterin des Stronach Institut für Stronach Group und Vizepräsidentin und Institutsleiterin des Stronach Institut für
sozialökonomische Gerechtigkeit.`) sozialökonomische Gerechtigkeit.`)
).toEqual(true); ).toBeTrue();
await loadingTask.destroy(); await loadingTask.destroy();
}); });
@ -4390,7 +4390,7 @@ FAMILY TRUST /u/a dated October 31, 1980 as amended, and STUART W. EPPERSON, not
individually but solely as Trustee of the STUART W. EPPERSON REVOCABLE LIVING individually but solely as Trustee of the STUART W. EPPERSON REVOCABLE LIVING
TRUST /u/a dated January 14th 1993 as amended, collectively referred to herein as Lessor, and TRUST /u/a dated January 14th 1993 as amended, collectively referred to herein as Lessor, and
Caron Broadcasting, Inc., an Ohio corporation (Lessee).`) Caron Broadcasting, Inc., an Ohio corporation (Lessee).`)
).toEqual(true); ).toBeTrue();
await loadingTask.destroy(); await loadingTask.destroy();
}); });
@ -4525,7 +4525,7 @@ Caron Broadcasting, Inc., an Ohio corporation (“Lessee”).`)
// No item should carry a hasEOL flag between the superscript and the // No item should carry a hasEOL flag between the superscript and the
// text that follows it. // text that follows it.
expect(items.every(i => !i.hasEOL)).toEqual(true); expect(items.every(i => !i.hasEOL)).toBeTrue();
// Full sentence must be reconstructable without a newline. // Full sentence must be reconstructable without a newline.
const text = mergeText(items); const text = mergeText(items);
@ -4872,7 +4872,7 @@ have written that much by now. So, heres to squashing bugs.`);
expect(operatorList.fnArray.length).toBeGreaterThan(100); expect(operatorList.fnArray.length).toBeGreaterThan(100);
expect(operatorList.argsArray.length).toBeGreaterThan(100); expect(operatorList.argsArray.length).toBeGreaterThan(100);
expect(operatorList.lastChunk).toEqual(true); expect(operatorList.lastChunk).toBeTrue();
expect(operatorList.separateAnnots).toEqual({ expect(operatorList.separateAnnots).toEqual({
form: false, form: false,
canvas: false, canvas: false,
@ -4921,7 +4921,7 @@ have written that much by now. So, heres to squashing bugs.`);
expect(opList.fnArray.length).toBeGreaterThan(100); expect(opList.fnArray.length).toBeGreaterThan(100);
expect(opList.argsArray.length).toBeGreaterThan(100); expect(opList.argsArray.length).toBeGreaterThan(100);
expect(opList.lastChunk).toEqual(true); expect(opList.lastChunk).toBeTrue();
expect(opList.separateAnnots).toBeNull(); expect(opList.separateAnnots).toBeNull();
await loadingTask1.destroy(); await loadingTask1.destroy();
@ -4933,7 +4933,7 @@ have written that much by now. So, heres to squashing bugs.`);
expect(opList.fnArray.length).toEqual(0); expect(opList.fnArray.length).toEqual(0);
expect(opList.argsArray.length).toEqual(0); expect(opList.argsArray.length).toEqual(0);
expect(opList.lastChunk).toEqual(true); expect(opList.lastChunk).toBeTrue();
expect(opList.separateAnnots).toBeNull(); expect(opList.separateAnnots).toBeNull();
await loadingTask2.destroy(); await loadingTask2.destroy();
@ -4951,7 +4951,7 @@ have written that much by now. So, heres to squashing bugs.`);
const pdfPage = await pdfDoc.getPage(1); const pdfPage = await pdfDoc.getPage(1);
const operatorList = await pdfPage.getOperatorList(); const operatorList = await pdfPage.getOperatorList();
expect(operatorList.lastChunk).toEqual(true); expect(operatorList.lastChunk).toBeTrue();
await loadingTask.destroy(); await loadingTask.destroy();
}); });
@ -4966,7 +4966,7 @@ have written that much by now. So, heres to squashing bugs.`);
expect(operatorList.fnArray.length).toBeGreaterThan(20); expect(operatorList.fnArray.length).toBeGreaterThan(20);
expect(operatorList.argsArray.length).toBeGreaterThan(20); expect(operatorList.argsArray.length).toBeGreaterThan(20);
expect(operatorList.lastChunk).toEqual(true); expect(operatorList.lastChunk).toBeTrue();
expect(operatorList.separateAnnots).toEqual({ expect(operatorList.separateAnnots).toEqual({
form: false, form: false,
canvas: false, canvas: false,
@ -4974,8 +4974,8 @@ have written that much by now. So, heres to squashing bugs.`);
// The `getOperatorList` method, similar to the `render` method, // The `getOperatorList` method, similar to the `render` method,
// is supposed to include any existing Annotation-operatorLists. // is supposed to include any existing Annotation-operatorLists.
expect(operatorList.fnArray.includes(OPS.beginAnnotation)).toEqual(true); expect(operatorList.fnArray.includes(OPS.beginAnnotation)).toBeTrue();
expect(operatorList.fnArray.includes(OPS.endAnnotation)).toEqual(true); expect(operatorList.fnArray.includes(OPS.endAnnotation)).toBeTrue();
await loadingTask.destroy(); await loadingTask.destroy();
}); });
@ -4993,7 +4993,7 @@ have written that much by now. So, heres to squashing bugs.`);
}); });
expect(opListAnnotDisable.fnArray.length).toEqual(0); expect(opListAnnotDisable.fnArray.length).toEqual(0);
expect(opListAnnotDisable.argsArray.length).toEqual(0); expect(opListAnnotDisable.argsArray.length).toEqual(0);
expect(opListAnnotDisable.lastChunk).toEqual(true); expect(opListAnnotDisable.lastChunk).toBeTrue();
expect(opListAnnotDisable.separateAnnots).toBeNull(); expect(opListAnnotDisable.separateAnnots).toBeNull();
const opListAnnotEnable = await pdfPage.getOperatorList({ const opListAnnotEnable = await pdfPage.getOperatorList({
@ -5001,7 +5001,7 @@ have written that much by now. So, heres to squashing bugs.`);
}); });
expect(opListAnnotEnable.fnArray.length).toBeGreaterThan(130); expect(opListAnnotEnable.fnArray.length).toBeGreaterThan(130);
expect(opListAnnotEnable.argsArray.length).toBeGreaterThan(130); expect(opListAnnotEnable.argsArray.length).toBeGreaterThan(130);
expect(opListAnnotEnable.lastChunk).toEqual(true); expect(opListAnnotEnable.lastChunk).toBeTrue();
expect(opListAnnotEnable.separateAnnots).toEqual({ expect(opListAnnotEnable.separateAnnots).toEqual({
form: false, form: false,
canvas: true, canvas: true,
@ -5018,7 +5018,7 @@ have written that much by now. So, heres to squashing bugs.`);
}); });
expect(opListAnnotEnableForms.fnArray.length).toBeGreaterThan(30); expect(opListAnnotEnableForms.fnArray.length).toBeGreaterThan(30);
expect(opListAnnotEnableForms.argsArray.length).toBeGreaterThan(30); expect(opListAnnotEnableForms.argsArray.length).toBeGreaterThan(30);
expect(opListAnnotEnableForms.lastChunk).toEqual(true); expect(opListAnnotEnableForms.lastChunk).toBeTrue();
expect(opListAnnotEnableForms.separateAnnots).toEqual({ expect(opListAnnotEnableForms.separateAnnots).toEqual({
form: true, form: true,
canvas: true, canvas: true,
@ -5028,14 +5028,14 @@ have written that much by now. So, heres to squashing bugs.`);
OPS.beginAnnotation OPS.beginAnnotation
); );
isUsingOwnCanvas = opListAnnotEnableForms.argsArray[firstAnnotIndex][4]; isUsingOwnCanvas = opListAnnotEnableForms.argsArray[firstAnnotIndex][4];
expect(isUsingOwnCanvas).toEqual(true); expect(isUsingOwnCanvas).toBeTrue();
const opListAnnotEnableStorage = await pdfPage.getOperatorList({ const opListAnnotEnableStorage = await pdfPage.getOperatorList({
annotationMode: AnnotationMode.ENABLE_STORAGE, annotationMode: AnnotationMode.ENABLE_STORAGE,
}); });
expect(opListAnnotEnableStorage.fnArray.length).toBeGreaterThan(150); expect(opListAnnotEnableStorage.fnArray.length).toBeGreaterThan(150);
expect(opListAnnotEnableStorage.argsArray.length).toBeGreaterThan(150); expect(opListAnnotEnableStorage.argsArray.length).toBeGreaterThan(150);
expect(opListAnnotEnableStorage.lastChunk).toEqual(true); expect(opListAnnotEnableStorage.lastChunk).toBeTrue();
expect(opListAnnotEnableStorage.separateAnnots).toEqual({ expect(opListAnnotEnableStorage.separateAnnots).toEqual({
form: false, form: false,
canvas: true, canvas: true,
@ -5076,7 +5076,7 @@ have written that much by now. So, heres to squashing bugs.`);
const opList = await pdfPage.getOperatorList(); const opList = await pdfPage.getOperatorList();
expect(opList.fnArray.length).toBeGreaterThan(25); expect(opList.fnArray.length).toBeGreaterThan(25);
expect(opList.argsArray.length).toBeGreaterThan(25); expect(opList.argsArray.length).toBeGreaterThan(25);
expect(opList.lastChunk).toEqual(true); expect(opList.lastChunk).toBeTrue();
await loadingTask.destroy(); await loadingTask.destroy();
}); });
@ -5188,7 +5188,7 @@ have written that much by now. So, heres to squashing bugs.`);
await renderTask.promise; await renderTask.promise;
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
} catch (reason) { } catch (reason) {
expect(reason).toBeInstanceOf(RenderingCancelledException); expect(reason).toBeInstanceOf(RenderingCancelledException);
expect(reason.message).toEqual("Rendering cancelled, page 1"); expect(reason.message).toEqual("Rendering cancelled, page 1");
@ -5219,7 +5219,7 @@ have written that much by now. So, heres to squashing bugs.`);
await renderTask.promise; await renderTask.promise;
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
} catch (reason) { } catch (reason) {
expect(reason).toBeInstanceOf(RenderingCancelledException); expect(reason).toBeInstanceOf(RenderingCancelledException);
} }
@ -5267,11 +5267,11 @@ have written that much by now. So, heres to squashing bugs.`);
renderTask2.promise.then( renderTask2.promise.then(
() => { () => {
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
}, },
reason => { reason => {
// It fails because we are already using this canvas. // It fails because we are already using this canvas.
expect(/multiple render\(\)/.test(reason.message)).toEqual(true); expect(/multiple render\(\)/.test(reason.message)).toBeTrue();
} }
), ),
]); ]);
@ -5302,7 +5302,7 @@ have written that much by now. So, heres to squashing bugs.`);
expect(renderTask.separateAnnots).toBeFalse(); expect(renderTask.separateAnnots).toBeFalse();
await pdfDoc.cleanup(); await pdfDoc.cleanup();
expect(true).toEqual(true); expect(true).toBeTrue();
canvasFactory.destroy(canvasAndCtx); canvasFactory.destroy(canvasAndCtx);
await loadingTask.destroy(); await loadingTask.destroy();
@ -5337,7 +5337,7 @@ have written that much by now. So, heres to squashing bugs.`);
await pdfDoc.cleanup(); await pdfDoc.cleanup();
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
} catch (reason) { } catch (reason) {
expect(reason).toBeInstanceOf(Error); expect(reason).toBeInstanceOf(Error);
expect(reason.message).toEqual( expect(reason.message).toEqual(
@ -5397,7 +5397,7 @@ have written that much by now. So, heres to squashing bugs.`);
if (i < NUM_PAGES_THRESHOLD) { if (i < NUM_PAGES_THRESHOLD) {
expect(objId).toEqual(`img_p${i - 1}_1`); expect(objId).toEqual(`img_p${i - 1}_1`);
expect(objs.has(objId)).toEqual(true); expect(objs.has(objId)).toBeTrue();
expect(commonObjs.has(objId)).toBeFalse(); expect(commonObjs.has(objId)).toBeFalse();
} else { } else {
expect(objId).toEqual( expect(objId).toEqual(
@ -5405,7 +5405,7 @@ have written that much by now. So, heres to squashing bugs.`);
); );
expect(objs.has(objId)).toBeFalse(); expect(objs.has(objId)).toBeFalse();
expect(commonObjs.has(objId)).toEqual(true); expect(commonObjs.has(objId)).toBeTrue();
} }
expect(width).toEqual(EXPECTED_WIDTH); expect(width).toEqual(EXPECTED_WIDTH);
expect(height).toEqual(EXPECTED_HEIGHT); expect(height).toEqual(EXPECTED_HEIGHT);
@ -5477,11 +5477,11 @@ have written that much by now. So, heres to squashing bugs.`);
if (i < NUM_PAGES_THRESHOLD) { if (i < NUM_PAGES_THRESHOLD) {
// Image decoded in the worker-thread; stored as a page-level object. // Image decoded in the worker-thread; stored as a page-level object.
expect(objs.has(objId)).toEqual(true); expect(objs.has(objId)).toBeTrue();
expect(commonObjs.has(objId)).toBeFalse(); expect(commonObjs.has(objId)).toBeFalse();
} else if (i === NUM_PAGES_THRESHOLD) { } else if (i === NUM_PAGES_THRESHOLD) {
expect(objs.has(objId)).toBeFalse(); expect(objs.has(objId)).toBeFalse();
expect(commonObjs.has(objId)).toEqual(true); expect(commonObjs.has(objId)).toBeTrue();
// Ensure that the image was copied in the main-thread (into // Ensure that the image was copied in the main-thread (into
// commonObjs), rather than being re-parsed in the worker-thread. // commonObjs), rather than being re-parsed in the worker-thread.
@ -5530,7 +5530,7 @@ have written that much by now. So, heres to squashing bugs.`);
if (i < NUM_PAGES_THRESHOLD) { if (i < NUM_PAGES_THRESHOLD) {
expect(objId).toEqual(`img_p${i - 1}_1`); expect(objId).toEqual(`img_p${i - 1}_1`);
expect(objs.has(objId)).toEqual(true); expect(objs.has(objId)).toBeTrue();
expect(commonObjs.has(objId)).toBeFalse(); expect(commonObjs.has(objId)).toBeFalse();
} else { } else {
expect(objId).toEqual( expect(objId).toEqual(
@ -5538,7 +5538,7 @@ have written that much by now. So, heres to squashing bugs.`);
); );
expect(objs.has(objId)).toBeFalse(); expect(objs.has(objId)).toBeFalse();
expect(commonObjs.has(objId)).toEqual(true); expect(commonObjs.has(objId)).toBeTrue();
} }
// Ensure that the actual image data is identical for all pages. // Ensure that the actual image data is identical for all pages.
@ -5645,7 +5645,7 @@ have written that much by now. So, heres to squashing bugs.`);
canvasAndCtx.context canvasAndCtx.context
.getImageData(0, 0, viewport.width, viewport.height) .getImageData(0, 0, viewport.width, viewport.height)
.data.some(channel => channel !== 0) .data.some(channel => channel !== 0)
).toEqual(true); ).toBeTrue();
canvasFactory.destroy(canvasAndCtx); canvasFactory.destroy(canvasAndCtx);
await loadingTask.destroy(); await loadingTask.destroy();
@ -7881,7 +7881,7 @@ small scripts as well as for`);
pdfDoc = await loadingTask.promise; pdfDoc = await loadingTask.promise;
const calculationOrder = await pdfDoc.getCalculationOrderIds(); const calculationOrder = await pdfDoc.getCalculationOrderIds();
expect(Array.isArray(calculationOrder)).toEqual(true); expect(Array.isArray(calculationOrder)).toBeTrue();
expect(calculationOrder.length).toEqual(1); expect(calculationOrder.length).toEqual(1);
expect(calculationOrder[0]).not.toEqual("6R"); expect(calculationOrder[0]).not.toEqual("6R");
expect(Object.keys((await pdfDoc.getFieldObjects()) || {})).toEqual([ expect(Object.keys((await pdfDoc.getFieldObjects()) || {})).toEqual([
@ -8054,12 +8054,12 @@ small scripts as well as for`);
const newPdfDoc = await newLoadingTask.promise; const newPdfDoc = await newLoadingTask.promise;
const outline = await newPdfDoc.getOutline(); const outline = await newPdfDoc.getOutline();
expect(Array.isArray(outline)).toEqual(true); expect(Array.isArray(outline)).toBeTrue();
expect(outline.length).toEqual(7); expect(outline.length).toEqual(7);
// Item [0]: explicit array dest // Item [0]: explicit array dest
expect(outline[0].title).toEqual("Page 1 - explicit dest"); expect(outline[0].title).toEqual("Page 1 - explicit dest");
expect(Array.isArray(outline[0].dest)).toEqual(true); expect(Array.isArray(outline[0].dest)).toBeTrue();
expect(outline[0].dest[1].name).toEqual("XYZ"); expect(outline[0].dest[1].name).toEqual("XYZ");
// Item [1]: named string dest // Item [1]: named string dest
@ -8091,15 +8091,15 @@ small scripts as well as for`);
// Section 1: explicit FitH dest // Section 1: explicit FitH dest
expect(chapter.items[0].title).toEqual("Section 1"); expect(chapter.items[0].title).toEqual("Section 1");
expect(Array.isArray(chapter.items[0].dest)).toEqual(true); expect(Array.isArray(chapter.items[0].dest)).toBeTrue();
expect(chapter.items[0].dest[1].name).toEqual("FitH"); expect(chapter.items[0].dest[1].name).toEqual("FitH");
// Section 2: named dest + bold + italic + red color // Section 2: named dest + bold + italic + red color
const section2 = chapter.items[1]; const section2 = chapter.items[1];
expect(section2.title).toEqual("Section 2"); expect(section2.title).toEqual("Section 2");
expect(typeof section2.dest).toEqual("string"); expect(typeof section2.dest).toEqual("string");
expect(section2.bold).toEqual(true); expect(section2.bold).toBeTrue();
expect(section2.italic).toEqual(true); expect(section2.italic).toBeTrue();
expect(section2.color).toEqual(new Uint8ClampedArray([255, 0, 0])); expect(section2.color).toEqual(new Uint8ClampedArray([255, 0, 0]));
// Subsection: parent with own dest + one child // Subsection: parent with own dest + one child
@ -8134,7 +8134,7 @@ small scripts as well as for`);
const newPdfDoc = await newLoadingTask.promise; const newPdfDoc = await newLoadingTask.promise;
const outline = await newPdfDoc.getOutline(); const outline = await newPdfDoc.getOutline();
expect(Array.isArray(outline)).toEqual(true); expect(Array.isArray(outline)).toBeTrue();
// 6 items: all except "No dest parent" (its child dest was on page 5). // 6 items: all except "No dest parent" (its child dest was on page 5).
expect(outline.length).toEqual(6); expect(outline.length).toEqual(6);
@ -8172,7 +8172,7 @@ small scripts as well as for`);
const newPdfDoc = await newLoadingTask.promise; const newPdfDoc = await newLoadingTask.promise;
const outline = await newPdfDoc.getOutline(); const outline = await newPdfDoc.getOutline();
expect(Array.isArray(outline)).toEqual(true); expect(Array.isArray(outline)).toBeTrue();
// 5 items: explicit dest (page1) and named dest (page2dest) are gone; // 5 items: explicit dest (page1) and named dest (page2dest) are gone;
// the 3 external-link items + "Chapter" + "No dest parent" remain. // the 3 external-link items + "Chapter" + "No dest parent" remain.
expect(outline.length).toEqual(5); expect(outline.length).toEqual(5);
@ -8241,13 +8241,13 @@ small scripts as well as for`);
expect(newPdfDoc.numPages).toEqual(2); expect(newPdfDoc.numPages).toEqual(2);
const outline = await newPdfDoc.getOutline(); const outline = await newPdfDoc.getOutline();
expect(Array.isArray(outline)).toEqual(true); expect(Array.isArray(outline)).toBeTrue();
// 5 items from copy A + 4 items from copy B = 9 total. // 5 items from copy A + 4 items from copy B = 9 total.
expect(outline.length).toEqual(9); expect(outline.length).toEqual(9);
// ---- Copy A items ---- // ---- Copy A items ----
expect(outline[0].title).toEqual("Page 1 - explicit dest"); expect(outline[0].title).toEqual("Page 1 - explicit dest");
expect(Array.isArray(outline[0].dest)).toEqual(true); expect(Array.isArray(outline[0].dest)).toBeTrue();
expect(outline[1].title).toEqual("External URL"); expect(outline[1].title).toEqual("External URL");
expect(outline[2].title).toEqual("Next Page action"); expect(outline[2].title).toEqual("Next Page action");
expect(outline[3].title).toEqual("Remote PDF link"); expect(outline[3].title).toEqual("Remote PDF link");
@ -8329,7 +8329,7 @@ small scripts as well as for`);
expect(newPdfDoc.numPages).toEqual(2); expect(newPdfDoc.numPages).toEqual(2);
const outline = await newPdfDoc.getOutline(); const outline = await newPdfDoc.getOutline();
expect(Array.isArray(outline)).toEqual(true); expect(Array.isArray(outline)).toBeTrue();
// Copy A: "Page 1 - explicit dest", "External URL", "Next Page // Copy A: "Page 1 - explicit dest", "External URL", "Next Page
// action", "Remote PDF link", "Chapter" (dest=page1dest) // action", "Remote PDF link", "Chapter" (dest=page1dest)
// Copy B: same 5 items but "Chapter" dest is renamed. // Copy B: same 5 items but "Chapter" dest is renamed.
@ -8343,7 +8343,7 @@ small scripts as well as for`);
const chapterDests = chapterItems.map(i => i.dest); const chapterDests = chapterItems.map(i => i.dest);
expect(chapterDests[0]).not.toEqual(chapterDests[1]); expect(chapterDests[0]).not.toEqual(chapterDests[1]);
// One of them is the original name. // One of them is the original name.
expect(chapterDests.includes("page1dest")).toEqual(true); expect(chapterDests.includes("page1dest")).toBeTrue();
// The other is a renamed version that still exists in the doc. // The other is a renamed version that still exists in the doc.
const renamedDest = chapterDests.find(d => d !== "page1dest"); const renamedDest = chapterDests.find(d => d !== "page1dest");
expect(typeof renamedDest).toEqual("string"); expect(typeof renamedDest).toEqual("string");
@ -8354,8 +8354,8 @@ small scripts as well as for`);
i => i.title === "Page 1 - explicit dest" i => i.title === "Page 1 - explicit dest"
); );
expect(page1Items.length).toEqual(2); expect(page1Items.length).toEqual(2);
expect(Array.isArray(page1Items[0].dest)).toEqual(true); expect(Array.isArray(page1Items[0].dest)).toBeTrue();
expect(Array.isArray(page1Items[1].dest)).toEqual(true); expect(Array.isArray(page1Items[1].dest)).toBeTrue();
await newLoadingTask.destroy(); await newLoadingTask.destroy();
}); });
@ -8378,7 +8378,7 @@ small scripts as well as for`);
expect(newPdfDoc.numPages).toEqual(1); expect(newPdfDoc.numPages).toEqual(1);
const outline = await newPdfDoc.getOutline(); const outline = await newPdfDoc.getOutline();
expect(Array.isArray(outline)).toEqual(true); expect(Array.isArray(outline)).toBeTrue();
expect(outline.length).toEqual(1); expect(outline.length).toEqual(1);
// "Parent" is kept as a plain container (dest cleared, no action). // "Parent" is kept as a plain container (dest cleared, no action).
@ -8390,7 +8390,7 @@ small scripts as well as for`);
// "Child" keeps its explicit dest pointing to the (only) kept page. // "Child" keeps its explicit dest pointing to the (only) kept page.
const child = parent.items[0]; const child = parent.items[0];
expect(child.title).toEqual("Child"); expect(child.title).toEqual("Child");
expect(Array.isArray(child.dest)).toEqual(true); expect(Array.isArray(child.dest)).toBeTrue();
await newLoadingTask.destroy(); await newLoadingTask.destroy();
}); });
@ -8432,7 +8432,7 @@ small scripts as well as for`);
await passwordNeededLoadingTask.promise.then( await passwordNeededLoadingTask.promise.then(
function () { function () {
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
}, },
function (err) { function (err) {
expect(err).toBeInstanceOf(PasswordException); expect(err).toBeInstanceOf(PasswordException);

View File

@ -154,7 +154,7 @@ describe("CFFParser", function () {
]); ]);
expect(properties.ascent).toEqual(900); expect(properties.ascent).toEqual(900);
expect(properties.descent).toEqual(-300); expect(properties.descent).toEqual(-300);
expect(properties.ascentScaled).toEqual(true); expect(properties.ascentScaled).toBeTrue();
}); });
it("repairs a FontBBox with unsigned-encoded negative coordinates", function () { it("repairs a FontBBox with unsigned-encoded negative coordinates", function () {
@ -177,7 +177,7 @@ describe("CFFParser", function () {
]); ]);
expect(properties.ascent).toEqual(989); expect(properties.ascent).toEqual(989);
expect(properties.descent).toEqual(-305); expect(properties.descent).toEqual(-305);
expect(properties.ascentScaled).toEqual(true); expect(properties.ascentScaled).toBeTrue();
}); });
it("doesn't replace a repairable FontBBox with an empty descriptor bbox", function () { it("doesn't replace a repairable FontBBox with an empty descriptor bbox", function () {
@ -198,7 +198,7 @@ describe("CFFParser", function () {
]); ]);
expect(properties.ascent).toEqual(989); expect(properties.ascent).toEqual(989);
expect(properties.descent).toEqual(-305); expect(properties.descent).toEqual(-305);
expect(properties.ascentScaled).toEqual(true); expect(properties.ascentScaled).toBeTrue();
}); });
it("repairs unsigned-encoded negative FontBBox without descriptor data", function () { it("repairs unsigned-encoded negative FontBBox without descriptor data", function () {
@ -217,7 +217,7 @@ describe("CFFParser", function () {
]); ]);
expect(properties.ascent).toEqual(989); expect(properties.ascent).toEqual(989);
expect(properties.descent).toEqual(-305); expect(properties.descent).toEqual(-305);
expect(properties.ascentScaled).toEqual(true); expect(properties.ascentScaled).toBeTrue();
}); });
it("preserves large positive upper FontBBox coordinates", function () { it("preserves large positive upper FontBBox coordinates", function () {
@ -238,7 +238,7 @@ describe("CFFParser", function () {
]); ]);
expect(properties.ascent).toEqual(989); expect(properties.ascent).toEqual(989);
expect(properties.descent).toEqual(-305); expect(properties.descent).toEqual(-305);
expect(properties.ascentScaled).toEqual(true); expect(properties.ascentScaled).toBeTrue();
}); });
it("repairs likely Ghostscript-zeroed FDArray private defaults", function () { it("repairs likely Ghostscript-zeroed FDArray private defaults", function () {
@ -383,7 +383,7 @@ describe("CFFParser", function () {
SEAC_ANALYSIS_ENABLED SEAC_ANALYSIS_ENABLED
).parse(); ).parse();
expect(embeddedCff.isCIDFont).toEqual(true); expect(embeddedCff.isCIDFont).toBeTrue();
expect(embeddedCff.fdArray[0].privateDict.getByName("BlueScale")).toEqual( expect(embeddedCff.fdArray[0].privateDict.getByName("BlueScale")).toEqual(
0.037 0.037
); );
@ -542,7 +542,7 @@ describe("CFFParser", function () {
it("parses predefined charsets", function () { it("parses predefined charsets", function () {
const charset = parser.parseCharsets(0, 0, null, true); const charset = parser.parseCharsets(0, 0, null, true);
expect(charset.predefined).toEqual(true); expect(charset.predefined).toBeTrue();
}); });
it("parses charset format 0", function () { it("parses charset format 0", function () {

View File

@ -157,7 +157,7 @@ describe("cmap", function () {
const str = "/WMode 1 def\n"; const str = "/WMode 1 def\n";
const stream = new StringStream(str); const stream = new StringStream(str);
const cmap = await CMapFactory.create({ encoding: stream }); const cmap = await CMapFactory.create({ encoding: stream });
expect(cmap.vertical).toEqual(true); expect(cmap.vertical).toBeTrue();
}); });
it("loads built in cmap", async function () { it("loads built in cmap", async function () {
@ -196,7 +196,7 @@ describe("cmap", function () {
}); });
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
} catch (reason) { } catch (reason) {
expect(reason).toBeInstanceOf(Error); expect(reason).toBeInstanceOf(Error);
expect(reason.message).toEqual("Unknown CMap name: null"); expect(reason.message).toEqual("Unknown CMap name: null");
@ -221,7 +221,7 @@ describe("cmap", function () {
}); });
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
} catch (reason) { } catch (reason) {
expect(reason).toBeInstanceOf(Error); expect(reason).toBeInstanceOf(Error);
expect(reason.message).toEqual( expect(reason.message).toEqual(
@ -250,12 +250,12 @@ describe("cmap", function () {
}); });
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
} catch (reason) { } catch (reason) {
expect(reason).toBeInstanceOf(Error); expect(reason).toBeInstanceOf(Error);
const message = reason.message; const message = reason.message;
expect(message.startsWith("Unable to load CMap data at: ")).toEqual(true); expect(message.startsWith("Unable to load CMap data at: ")).toBeTrue();
expect(message.endsWith("/external/bcmaps/Adobe-Japan1-1")).toEqual(true); expect(message.endsWith("/external/bcmaps/Adobe-Japan1-1")).toBeTrue();
} }
}); });
}); });

View File

@ -40,7 +40,7 @@ async function testCrossOriginRedirects({
await fullReader.headersReady; await fullReader.headersReady;
// Sanity check: We can only test range requests if supported: // Sanity check: We can only test range requests if supported:
expect(fullReader.isRangeSupported).toEqual(true); expect(fullReader.isRangeSupported).toBeTrue();
// ^ When range requests are supported (and streaming is disabled), the full // ^ When range requests are supported (and streaming is disabled), the full
// initial request is aborted and we do not need to call fullReader.cancel(). // initial request is aborted and we do not need to call fullReader.cancel().

View File

@ -218,10 +218,10 @@ describe("core_utils", function () {
describe("isWhiteSpace", function () { describe("isWhiteSpace", function () {
it("handles space characters", function () { it("handles space characters", function () {
expect(isWhiteSpace(0x20)).toEqual(true); expect(isWhiteSpace(0x20)).toBeTrue();
expect(isWhiteSpace(0x09)).toEqual(true); expect(isWhiteSpace(0x09)).toBeTrue();
expect(isWhiteSpace(0x0d)).toEqual(true); expect(isWhiteSpace(0x0d)).toBeTrue();
expect(isWhiteSpace(0x0a)).toEqual(true); expect(isWhiteSpace(0x0a)).toBeTrue();
}); });
it("handles non-space characters", function () { it("handles non-space characters", function () {
@ -336,13 +336,13 @@ describe("core_utils", function () {
expect(validateCSSFont(cssFontInfo)).toBeFalse(); expect(validateCSSFont(cssFontInfo)).toBeFalse();
cssFontInfo.fontFamily = `"blah blah \\" blah blah"`; cssFontInfo.fontFamily = `"blah blah \\" blah blah"`;
expect(validateCSSFont(cssFontInfo)).toEqual(true); expect(validateCSSFont(cssFontInfo)).toBeTrue();
cssFontInfo.fontFamily = `'blah blah ' blah blah'`; cssFontInfo.fontFamily = `'blah blah ' blah blah'`;
expect(validateCSSFont(cssFontInfo)).toBeFalse(); expect(validateCSSFont(cssFontInfo)).toBeFalse();
cssFontInfo.fontFamily = `'blah blah \\' blah blah'`; cssFontInfo.fontFamily = `'blah blah \\' blah blah'`;
expect(validateCSSFont(cssFontInfo)).toEqual(true); expect(validateCSSFont(cssFontInfo)).toBeTrue();
cssFontInfo.fontFamily = `"blah blah `; cssFontInfo.fontFamily = `"blah blah `;
expect(validateCSSFont(cssFontInfo)).toBeFalse(); expect(validateCSSFont(cssFontInfo)).toBeFalse();
@ -357,7 +357,7 @@ describe("core_utils", function () {
expect(validateCSSFont(cssFontInfo)).toBeFalse(); expect(validateCSSFont(cssFontInfo)).toBeFalse();
cssFontInfo.fontFamily = "blah blah blah"; cssFontInfo.fontFamily = "blah blah blah";
expect(validateCSSFont(cssFontInfo)).toEqual(true); expect(validateCSSFont(cssFontInfo)).toBeTrue();
cssFontInfo.fontFamily = "blah 0blah blah"; cssFontInfo.fontFamily = "blah 0blah blah";
expect(validateCSSFont(cssFontInfo)).toBeFalse(); expect(validateCSSFont(cssFontInfo)).toBeFalse();
@ -369,10 +369,10 @@ describe("core_utils", function () {
expect(validateCSSFont(cssFontInfo)).toBeFalse(); expect(validateCSSFont(cssFontInfo)).toBeFalse();
cssFontInfo.fontFamily = "blah blah -blah"; cssFontInfo.fontFamily = "blah blah -blah";
expect(validateCSSFont(cssFontInfo)).toEqual(true); expect(validateCSSFont(cssFontInfo)).toBeTrue();
cssFontInfo.fontFamily = "blah fdqAJqjHJK23kl23__--Kj blah"; cssFontInfo.fontFamily = "blah fdqAJqjHJK23kl23__--Kj blah";
expect(validateCSSFont(cssFontInfo)).toEqual(true); expect(validateCSSFont(cssFontInfo)).toBeTrue();
cssFontInfo.fontFamily = "blah fdqAJqjH$JK23kl23__--Kj blah"; cssFontInfo.fontFamily = "blah fdqAJqjH$JK23kl23__--Kj blah";
expect(validateCSSFont(cssFontInfo)).toBeFalse(); expect(validateCSSFont(cssFontInfo)).toBeFalse();

View File

@ -352,7 +352,7 @@ describe("crypto", function () {
userValidation, userValidation,
userPassword userPassword
); );
expect(result).toEqual(true); expect(result).toBeTrue();
}); });
it("should correctly check an owner key", function () { it("should correctly check an owner key", function () {
@ -378,7 +378,7 @@ describe("crypto", function () {
uBytes, uBytes,
ownerPassword ownerPassword
); );
expect(result).toEqual(true); expect(result).toBeTrue();
}); });
it("should generate a file encryption key from the user key", function () { it("should generate a file encryption key from the user key", function () {
@ -445,7 +445,7 @@ describe("crypto", function () {
userValidation, userValidation,
userPassword userPassword
); );
expect(result).toEqual(true); expect(result).toBeTrue();
}); });
it("should correctly check an owner key", function () { it("should correctly check an owner key", function () {
@ -470,7 +470,7 @@ describe("crypto", function () {
uBytes, uBytes,
ownerPassword ownerPassword
); );
expect(result).toEqual(true); expect(result).toBeTrue();
}); });
it("should generate a file encryption key from the user key", function () { it("should generate a file encryption key from the user key", function () {
@ -573,10 +573,10 @@ describe("CipherTransformFactory", function () {
function ensurePasswordCorrect(dict, fileId, password) { function ensurePasswordCorrect(dict, fileId, password) {
try { try {
const factory = new CipherTransformFactory(dict, fileId, password); const factory = new CipherTransformFactory(dict, fileId, password);
expect("createCipherTransform" in factory).toEqual(true); expect("createCipherTransform" in factory).toBeTrue();
} catch { } catch {
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
} }
} }
@ -586,7 +586,7 @@ describe("CipherTransformFactory", function () {
new CipherTransformFactory(dict, fileId, password); new CipherTransformFactory(dict, fileId, password);
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
} catch (ex) { } catch (ex) {
expect(ex).toBeInstanceOf(PasswordException); expect(ex).toBeInstanceOf(PasswordException);
expect(ex.code).toEqual(PasswordResponses.NEED_PASSWORD); expect(ex.code).toEqual(PasswordResponses.NEED_PASSWORD);
@ -599,7 +599,7 @@ describe("CipherTransformFactory", function () {
new CipherTransformFactory(dict, fileId, password); new CipherTransformFactory(dict, fileId, password);
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
} catch (ex) { } catch (ex) {
expect(ex).toBeInstanceOf(PasswordException); expect(ex).toBeInstanceOf(PasswordException);
expect(ex.code).toEqual(PasswordResponses.INCORRECT_PASSWORD); expect(ex.code).toEqual(PasswordResponses.INCORRECT_PASSWORD);

View File

@ -205,7 +205,7 @@ describe("custom ownerDocument", function () {
await loadingTask.destroy(); await loadingTask.destroy();
canvasFactory.destroy(canvasAndCtx); canvasFactory.destroy(canvasAndCtx);
expect(style.remove.called).toBe(true); expect(style.remove.called).toBeTrue();
}); });
it("should use a constructable stylesheet for CSS font rules", function () { it("should use a constructable stylesheet for CSS font rules", function () {

View File

@ -181,7 +181,7 @@ describe("display_utils", function () {
new Blob([typedArray], { type: "application/pdf" }) new Blob([typedArray], { type: "application/pdf" })
); );
// Sanity check to ensure that a "blob:" URL was returned. // Sanity check to ensure that a "blob:" URL was returned.
expect(blobUrl.startsWith("blob:")).toEqual(true); expect(blobUrl.startsWith("blob:")).toBeTrue();
expect(getPdfFilenameFromUrl(blobUrl + "?file.pdf")).toEqual("file.pdf"); expect(getPdfFilenameFromUrl(blobUrl + "?file.pdf")).toEqual("file.pdf");
}); });
@ -225,7 +225,7 @@ describe("display_utils", function () {
it("handles relative Fetch URLs", function () { it("handles relative Fetch URLs", function () {
expect(isValidFetchUrl("/foo", "file://www.example.com")).toBeFalse(); expect(isValidFetchUrl("/foo", "file://www.example.com")).toBeFalse();
expect(isValidFetchUrl("/foo", "http://www.example.com")).toEqual(true); expect(isValidFetchUrl("/foo", "http://www.example.com")).toBeTrue();
}); });
it("handles unsupported Fetch protocols", function () { it("handles unsupported Fetch protocols", function () {
@ -234,8 +234,8 @@ describe("display_utils", function () {
}); });
it("handles supported Fetch protocols", function () { it("handles supported Fetch protocols", function () {
expect(isValidFetchUrl("http://www.example.com")).toEqual(true); expect(isValidFetchUrl("http://www.example.com")).toBeTrue();
expect(isValidFetchUrl("https://www.example.com")).toEqual(true); expect(isValidFetchUrl("https://www.example.com")).toBeTrue();
}); });
}); });

View File

@ -650,7 +650,7 @@ describe("document", function () {
pdfDocument = getDocument(acroForm, xref); pdfDocument = getDocument(acroForm, xref);
hasJSActions = await pdfDocument.hasJSActions; hasJSActions = await pdfDocument.hasJSActions;
expect(hasJSActions).toEqual(true); expect(hasJSActions).toBeTrue();
}); });
}); });
}); });

View File

@ -30,7 +30,7 @@ describe("encodings", function () {
for (const knownEncodingName of knownEncodingNames) { for (const knownEncodingName of knownEncodingNames) {
const encoding = getEncoding(knownEncodingName); const encoding = getEncoding(knownEncodingName);
expect(Array.isArray(encoding)).toEqual(true); expect(Array.isArray(encoding)).toBeTrue();
expect(encoding.length).toEqual(256); expect(encoding.length).toEqual(256);
for (const item of encoding) { for (const item of encoding) {

View File

@ -74,7 +74,7 @@ describe("evaluator", function () {
stream, stream,
new ResourcesMock() new ResourcesMock()
); );
expect(!!result.fnArray && !!result.argsArray).toEqual(true); expect(!!result.fnArray && !!result.argsArray).toBeTrue();
expect(result.fnArray.length).toEqual(1); expect(result.fnArray.length).toEqual(1);
expect(result.fnArray[0]).toEqual(OPS.constructPath); expect(result.fnArray[0]).toEqual(OPS.constructPath);
expect(result.argsArray[0]).toEqual([OPS.fill, [null], null]); expect(result.argsArray[0]).toEqual([OPS.fill, [null], null]);
@ -87,7 +87,7 @@ describe("evaluator", function () {
stream, stream,
new ResourcesMock() new ResourcesMock()
); );
expect(!!result.fnArray && !!result.argsArray).toEqual(true); expect(!!result.fnArray && !!result.argsArray).toBeTrue();
expect(result.fnArray.length).toEqual(1); expect(result.fnArray.length).toEqual(1);
expect(result.fnArray[0]).toEqual(OPS.restore); expect(result.fnArray[0]).toEqual(OPS.restore);
}); });
@ -130,7 +130,7 @@ describe("evaluator", function () {
stream, stream,
new ResourcesMock() new ResourcesMock()
); );
expect(!!result.fnArray && !!result.argsArray).toEqual(true); expect(!!result.fnArray && !!result.argsArray).toBeTrue();
expect(result.fnArray.length).toEqual(3); expect(result.fnArray.length).toEqual(3);
expect(result.fnArray).toEqual([ expect(result.fnArray).toEqual([
OPS.constructPath, OPS.constructPath,
@ -151,7 +151,7 @@ describe("evaluator", function () {
stream, stream,
resources resources
); );
expect(!!result.fnArray && !!result.argsArray).toEqual(true); expect(!!result.fnArray && !!result.argsArray).toBeTrue();
expect(result.fnArray).toEqual([ expect(result.fnArray).toEqual([
OPS.constructPath, OPS.constructPath,
OPS.constructPath, OPS.constructPath,
@ -169,7 +169,7 @@ describe("evaluator", function () {
stream, stream,
new ResourcesMock() new ResourcesMock()
); );
expect(!!result.fnArray && !!result.argsArray).toEqual(true); expect(!!result.fnArray && !!result.argsArray).toBeTrue();
expect(result.fnArray.length).toEqual(2); expect(result.fnArray.length).toEqual(2);
expect(result.fnArray[0]).toEqual(OPS.constructPath); expect(result.fnArray[0]).toEqual(OPS.constructPath);
expect(result.fnArray[1]).toEqual(OPS.setTextRise); expect(result.fnArray[1]).toEqual(OPS.setTextRise);
@ -185,14 +185,14 @@ describe("evaluator", function () {
stream, stream,
new ResourcesMock() new ResourcesMock()
); );
expect(!!result.fnArray && !!result.argsArray).toEqual(true); expect(!!result.fnArray && !!result.argsArray).toBeTrue();
expect(result.fnArray.length).toEqual(3); expect(result.fnArray.length).toEqual(3);
expect(result.fnArray[0]).toEqual(OPS.setFlatness); expect(result.fnArray[0]).toEqual(OPS.setFlatness);
expect(result.fnArray[1]).toEqual(OPS.setRenderingIntent); expect(result.fnArray[1]).toEqual(OPS.setRenderingIntent);
expect(result.fnArray[2]).toEqual(OPS.constructPath); expect(result.fnArray[2]).toEqual(OPS.constructPath);
expect(result.argsArray.length).toEqual(3); expect(result.argsArray.length).toEqual(3);
expect(result.argsArray[0].length).toEqual(1); expect(result.argsArray[0].length).toEqual(1);
expect(result.argsArray[0][0]).toEqual(true); expect(result.argsArray[0][0]).toBeTrue();
expect(result.argsArray[1].length).toEqual(1); expect(result.argsArray[1].length).toEqual(1);
expect(result.argsArray[1][0]).toBeFalse(); expect(result.argsArray[1][0]).toBeFalse();
expect(result.argsArray[2]).toEqual([OPS.endPath, [null], null]); expect(result.argsArray[2]).toEqual([OPS.endPath, [null], null]);
@ -296,7 +296,7 @@ describe("evaluator", function () {
); );
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
} catch (reason) { } catch (reason) {
expect(reason).toBeInstanceOf(FormatError); expect(reason).toBeInstanceOf(FormatError);
expect(reason.message).toEqual( expect(reason.message).toEqual(
@ -313,7 +313,7 @@ describe("evaluator", function () {
stream, stream,
new ResourcesMock() new ResourcesMock()
); );
expect(!!result.fnArray && !!result.argsArray).toEqual(true); expect(!!result.fnArray && !!result.argsArray).toBeTrue();
expect(result.fnArray.length).toEqual(4); expect(result.fnArray.length).toEqual(4);
expect(result.fnArray[0]).toEqual(OPS.save); expect(result.fnArray[0]).toEqual(OPS.save);
expect(result.fnArray[1]).toEqual(OPS.save); expect(result.fnArray[1]).toEqual(OPS.save);
@ -332,7 +332,7 @@ describe("evaluator", function () {
); );
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
} catch (reason) { } catch (reason) {
expect(reason).toBeInstanceOf(FormatError); expect(reason).toBeInstanceOf(FormatError);
expect(reason.message).toEqual("XObject should be a stream"); expect(reason.message).toEqual("XObject should be a stream");
@ -416,9 +416,9 @@ describe("evaluator", function () {
}); });
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
} catch { } catch {
expect(!!result.fnArray && !!result.argsArray).toEqual(true); expect(!!result.fnArray && !!result.argsArray).toBeTrue();
expect(result.fnArray.length).toEqual(0); expect(result.fnArray.length).toEqual(0);
} }
}); });
@ -437,9 +437,9 @@ describe("evaluator", function () {
}); });
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
} catch { } catch {
expect(true).toEqual(true); expect(true).toBeTrue();
} }
}); });
}); });

View File

@ -209,7 +209,7 @@ describe("event_utils", function () {
}); });
function domEventListener() { function domEventListener() {
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
} }
document.addEventListener("test", domEventListener); document.addEventListener("test", domEventListener);
@ -240,7 +240,7 @@ describe("event_utils", function () {
}).then( }).then(
function () { function () {
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
}, },
function (reason) { function (reason) {
expect(reason).toBeInstanceOf(Error); expect(reason).toBeInstanceOf(Error);
@ -253,7 +253,7 @@ describe("event_utils", function () {
}).then( }).then(
function () { function () {
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
}, },
function (reason) { function (reason) {
expect(reason).toBeInstanceOf(Error); expect(reason).toBeInstanceOf(Error);
@ -267,7 +267,7 @@ describe("event_utils", function () {
}).then( }).then(
function () { function () {
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
}, },
function (reason) { function (reason) {
expect(reason).toBeInstanceOf(Error); expect(reason).toBeInstanceOf(Error);

View File

@ -63,7 +63,7 @@ describe("fetch_stream", function () {
await read(); await read();
expect(len).toEqual(pdfLength); expect(len).toEqual(pdfLength);
expect(isStreamingSupported).toEqual(true); expect(isStreamingSupported).toBeTrue();
expect(isRangeSupported).toBeFalse(); expect(isRangeSupported).toBeFalse();
}); });
@ -112,9 +112,9 @@ describe("fetch_stream", function () {
read(rangeReader2, result2), read(rangeReader2, result2),
]); ]);
expect(isStreamingSupported).toEqual(true); expect(isStreamingSupported).toBeTrue();
expect(isRangeSupported).toEqual(true); expect(isRangeSupported).toBeTrue();
expect(fullReaderCancelled).toEqual(true); expect(fullReaderCancelled).toBeTrue();
expect(result1.value).toEqual(rangeSize); expect(result1.value).toEqual(rangeSize);
expect(result2.value).toEqual(tailSize); expect(result2.value).toEqual(tailSize);
}); });

View File

@ -81,7 +81,7 @@ describe("message_handler", function () {
await sleep(10); await sleep(10);
result = await reader.read(); result = await reader.read();
expect(result.value).toBeUndefined(); expect(result.value).toBeUndefined();
expect(result.done).toEqual(true); expect(result.done).toBeTrue();
}); });
it("should not read any data when cancelled", async function () { it("should not read any data when cancelled", async function () {
@ -191,7 +191,7 @@ describe("message_handler", function () {
await reader.read(); await reader.read();
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
} catch (reason) { } catch (reason) {
expect(log).toEqual("01pe"); expect(log).toEqual("01pe");
expect(reason).toBeInstanceOf(UnknownErrorException); expect(reason).toBeInstanceOf(UnknownErrorException);
@ -261,7 +261,7 @@ describe("message_handler", function () {
result = await reader.read(); result = await reader.read();
expect(result.value).toBeUndefined(); expect(result.value).toBeUndefined();
expect(result.done).toEqual(true); expect(result.done).toBeTrue();
}); });
it( it(
@ -328,7 +328,7 @@ describe("message_handler", function () {
result = await reader.read(); result = await reader.read();
expect(result.value).toBeUndefined(); expect(result.value).toBeUndefined();
expect(result.done).toEqual(true); expect(result.done).toBeTrue();
} }
); );
@ -382,7 +382,7 @@ describe("message_handler", function () {
result = await reader.read(); result = await reader.read();
expect(result.value).toBeUndefined(); expect(result.value).toBeUndefined();
expect(result.done).toEqual(true); expect(result.done).toBeTrue();
}); });
}); });
}); });

View File

@ -114,8 +114,8 @@ describe("network", function () {
expect(result1.value).toEqual(rangeSize); expect(result1.value).toEqual(rangeSize);
expect(result2.value).toEqual(tailSize); expect(result2.value).toEqual(tailSize);
expect(isStreamingSupported).toBeFalse(); expect(isStreamingSupported).toBeFalse();
expect(isRangeSupported).toEqual(true); expect(isRangeSupported).toBeTrue();
expect(fullReaderCancelled).toEqual(true); expect(fullReaderCancelled).toBeTrue();
}); });
it(`handle reading ranges with missing/invalid "Content-Range" header`, async function () { it(`handle reading ranges with missing/invalid "Content-Range" header`, async function () {
@ -140,7 +140,7 @@ describe("network", function () {
await fullReader.headersReady; await fullReader.headersReady;
// Ensure that range requests are supported. // Ensure that range requests are supported.
expect(fullReader.isRangeSupported).toEqual(true); expect(fullReader.isRangeSupported).toBeTrue();
// We shall be able to close the full reader without issues. // We shall be able to close the full reader without issues.
fullReader.cancel(new AbortException("Don't need fullReader.")); fullReader.cancel(new AbortException("Don't need fullReader."));
@ -153,7 +153,7 @@ describe("network", function () {
await rangeReader.read(); await rangeReader.read();
// Shouldn't get here. // Shouldn't get here.
expect(false).toEqual(true); expect(false).toBeTrue();
} catch (ex) { } catch (ex) {
expect(ex).toBeInstanceOf(ResponseException); expect(ex).toBeInstanceOf(ResponseException);
expect(ex.status).toEqual(0); expect(ex.status).toEqual(0);

View File

@ -114,8 +114,8 @@ describe("node_stream", function () {
expect(result1.value).toEqual(rangeSize); expect(result1.value).toEqual(rangeSize);
expect(result2.value).toEqual(tailSize); expect(result2.value).toEqual(tailSize);
expect(isStreamingSupported).toBeFalse(); expect(isStreamingSupported).toBeFalse();
expect(isRangeSupported).toEqual(true); expect(isRangeSupported).toBeTrue();
expect(fullReaderCancelled).toEqual(true); expect(fullReaderCancelled).toBeTrue();
}); });
it("read filesystem pdf files (smaller than two range requests)", async function () { it("read filesystem pdf files (smaller than two range requests)", async function () {

View File

@ -134,16 +134,16 @@ describe("obj_bin_transform", function () {
const buffer = compileFontInfo(fontInfo); const buffer = compileFontInfo(fontInfo);
expect(buffer.byteLength).toEqual(sizeEstimate); expect(buffer.byteLength).toEqual(sizeEstimate);
const deserialized = new FontInfo({ buffer }); const deserialized = new FontInfo({ buffer });
expect(deserialized.black).toEqual(true); expect(deserialized.black).toBeTrue();
expect(deserialized.bold).toEqual(true); expect(deserialized.bold).toBeTrue();
expect(deserialized.disableFontFace).toEqual(true); expect(deserialized.disableFontFace).toBeTrue();
expect(deserialized.fontExtraProperties).toEqual(true); expect(deserialized.fontExtraProperties).toBeTrue();
expect(deserialized.isInvalidPDFjsFont).toEqual(true); expect(deserialized.isInvalidPDFjsFont).toBeTrue();
expect(deserialized.isType3Font).toEqual(true); expect(deserialized.isType3Font).toBeTrue();
expect(deserialized.italic).toEqual(true); expect(deserialized.italic).toBeTrue();
expect(deserialized.missingFile).toEqual(true); expect(deserialized.missingFile).toBeTrue();
expect(deserialized.remeasure).toEqual(true); expect(deserialized.remeasure).toBeTrue();
expect(deserialized.vertical).toEqual(true); expect(deserialized.vertical).toBeTrue();
expect(deserialized.ascent).toEqual(1); expect(deserialized.ascent).toEqual(1);
expect(deserialized.defaultWidth).toEqual(1); expect(deserialized.defaultWidth).toEqual(1);
expect(deserialized.descent).toEqual(1); expect(deserialized.descent).toEqual(1);

View File

@ -120,7 +120,7 @@ describe("parser", function () {
"work-around rounding bugs in Chromium browsers." "work-around rounding bugs in Chromium browsers."
); );
expect(true).toEqual(true); expect(true).toBeTrue();
continue; continue;
} }
expect(result).toEqual(expected); expect(result).toEqual(expected);

View File

@ -36,10 +36,10 @@ describe("pdf_find_utils", function () {
it("treats ASCII punctuation as a word boundary", function () { it("treats ASCII punctuation as a word boundary", function () {
const content = "foo-bar (baz)"; const content = "foo-bar (baz)";
expect(isEntireWord(content, 0, 3)).toEqual(true); // "foo" before "-" expect(isEntireWord(content, 0, 3)).toBeTrue(); // "foo" before "-"
expect(isEntireWord(content, 4, 3)).toEqual(true); // "bar" before " " expect(isEntireWord(content, 4, 3)).toBeTrue(); // "bar" before " "
expect(isEntireWord(content, 9, 3)).toEqual(true); // "baz" inside "()" expect(isEntireWord(content, 9, 3)).toBeTrue(); // "baz" inside "()"
expect(isEntireWord(content, 0, 7)).toEqual(true); // "foo-bar" expect(isEntireWord(content, 0, 7)).toBeTrue(); // "foo-bar"
}); });
it("treats non-ASCII punctuation as a word boundary", function () { it("treats non-ASCII punctuation as a word boundary", function () {
@ -51,7 +51,7 @@ describe("pdf_find_utils", function () {
["—", "—"], // em dashes ["—", "—"], // em dashes
]) { ]) {
const content = `${open}word${close}`; const content = `${open}word${close}`;
expect(isEntireWord(content, 1, 4)).toEqual(true); // "word" expect(isEntireWord(content, 1, 4)).toBeTrue(); // "word"
expect(isEntireWord(content, 1, 3)).toBeFalse(); // "wor" expect(isEntireWord(content, 1, 3)).toBeFalse(); // "wor"
} }
}); });
@ -61,16 +61,16 @@ describe("pdf_find_utils", function () {
// preceding word from matching as an entire word. // preceding word from matching as an entire word.
for (const superscript of ["¹", "²", "³", "⁴"]) { for (const superscript of ["¹", "²", "³", "⁴"]) {
const content = `word${superscript}`; const content = `word${superscript}`;
expect(isEntireWord(content, 0, 4)).toEqual(true); // "word" expect(isEntireWord(content, 0, 4)).toBeTrue(); // "word"
} }
}); });
it("matches a word next to a contraction apostrophe", function () { it("matches a word next to a contraction apostrophe", function () {
// The apostrophe is a word break in isolation (as in Firefox's find), so // The apostrophe is a word break in isolation (as in Firefox's find), so
// the leading part of a contraction is still an entire word. // the leading part of a contraction is still an entire word.
expect(isEntireWord("I can't do that", 2, 3)).toEqual(true); // "can" expect(isEntireWord("I can't do that", 2, 3)).toBeTrue(); // "can"
expect(isEntireWord("don't", 0, 3)).toEqual(true); // "don" expect(isEntireWord("don't", 0, 3)).toBeTrue(); // "don"
expect(isEntireWord("it's", 0, 2)).toEqual(true); // "it" expect(isEntireWord("it's", 0, 2)).toBeTrue(); // "it"
}); });
it("keeps a word joined by a connecting character", function () { it("keeps a word joined by a connecting character", function () {
@ -82,7 +82,7 @@ describe("pdf_find_utils", function () {
// "café" in the normalized page content is NFD: "cafe" followed by // "café" in the normalized page content is NFD: "cafe" followed by
// U+0301 COMBINING ACUTE ACCENT. // U+0301 COMBINING ACUTE ACCENT.
const content = "café".normalize("NFD"); const content = "café".normalize("NFD");
expect(isEntireWord(content, 0, content.length)).toEqual(true); // whole expect(isEntireWord(content, 0, content.length)).toBeTrue(); // whole
expect(isEntireWord(content, 0, 3)).toBeFalse(); // "caf" expect(isEntireWord(content, 0, 3)).toBeFalse(); // "caf"
expect(isEntireWord(content, 0, 4)).toBeFalse(); // "cafe", before U+0301 expect(isEntireWord(content, 0, 4)).toBeFalse(); // "cafe", before U+0301
}); });
@ -93,7 +93,7 @@ describe("pdf_find_utils", function () {
expect(isEntireWord(ab, 2, 1)).toBeFalse(); // "b" inside "áb" expect(isEntireWord(ab, 2, 1)).toBeFalse(); // "b" inside "áb"
expect(isEntireWord(ab, 0, 2)).toBeFalse(); // "á" inside "áb" expect(isEntireWord(ab, 0, 2)).toBeFalse(); // "á" inside "áb"
// "café" is a whole word before a space, but not inside "caféteria". // "café" is a whole word before a space, but not inside "caféteria".
expect(isEntireWord("café bar".normalize("NFD"), 0, 5)).toEqual(true); expect(isEntireWord("café bar".normalize("NFD"), 0, 5)).toBeTrue();
expect(isEntireWord("caféteria".normalize("NFD"), 0, 5)).toBeFalse(); expect(isEntireWord("caféteria".normalize("NFD"), 0, 5)).toBeFalse();
}); });
@ -103,7 +103,7 @@ describe("pdf_find_utils", function () {
expect(isEntireWord(withBoldA, 0, 1)).toBeFalse(); // "a" expect(isEntireWord(withBoldA, 0, 1)).toBeFalse(); // "a"
expect(isEntireWord(withBoldA, 3, 1)).toBeFalse(); // "b" expect(isEntireWord(withBoldA, 3, 1)).toBeFalse(); // "b"
// Each CJK ideograph is its own word (𠀀 = U+20000, a surrogate pair). // Each CJK ideograph is its own word (𠀀 = U+20000, a surrogate pair).
expect(isEntireWord("中\u{20000}国", 0, 1)).toEqual(true); // "中" expect(isEntireWord("中\u{20000}国", 0, 1)).toBeTrue(); // "中"
}); });
}); });
}); });

View File

@ -41,12 +41,12 @@ describe("pdf_history", function () {
}); });
it("should accept equal destination hashes", function () { it("should accept equal destination hashes", function () {
expect(isDestHashesEqual("page.157", "page.157")).toEqual(true); expect(isDestHashesEqual("page.157", "page.157")).toBeTrue();
expect(isDestHashesEqual("nameddest=page.157", "page.157")).toEqual(true); expect(isDestHashesEqual("nameddest=page.157", "page.157")).toBeTrue();
expect( expect(
isDestHashesEqual("nameddest=page.157&zoom=100", "page.157") isDestHashesEqual("nameddest=page.157&zoom=100", "page.157")
).toEqual(true); ).toBeTrue();
}); });
}); });
@ -67,13 +67,13 @@ describe("pdf_history", function () {
}); });
it("should accept equal destination arrays", function () { it("should accept equal destination arrays", function () {
expect(isDestArraysEqual(firstDest, firstDest)).toEqual(true); expect(isDestArraysEqual(firstDest, firstDest)).toBeTrue();
expect(isDestArraysEqual(firstDest, fifthDest)).toEqual(true); expect(isDestArraysEqual(firstDest, fifthDest)).toBeTrue();
const firstDestCopy = firstDest.slice(); const firstDestCopy = firstDest.slice();
expect(firstDest).not.toBe(firstDestCopy); expect(firstDest).not.toBe(firstDestCopy);
expect(isDestArraysEqual(firstDest, firstDestCopy)).toEqual(true); expect(isDestArraysEqual(firstDest, firstDestCopy)).toBeTrue();
}); });
}); });
}); });

View File

@ -155,7 +155,7 @@ describe("PDFViewer", function () {
const view = iterator.next().value; const view = iterator.next().value;
buffer.push(view); buffer.push(view);
} }
expect(buffer.has(viewsMap.get(1))).toEqual(true); expect(buffer.has(viewsMap.get(1))).toBeTrue();
expect(buffer.has(viewsMap.get(2))).toBeFalse(); expect(buffer.has(viewsMap.get(2))).toBeFalse();
}); });
}); });

View File

@ -1189,7 +1189,7 @@ describe("PostScript Type 4 lexer, parser, and Wasm compiler", function () {
it("true and false become PsConstNode", function () { it("true and false become PsConstNode", function () {
const out = toTree("{ true false }", 0); const out = toTree("{ true false }", 0);
expect(out[0]).toBeInstanceOf(PsConstNode); expect(out[0]).toBeInstanceOf(PsConstNode);
expect(out[0].value).toBe(true); expect(out[0].value).toBeTrue();
expect(out[1]).toBeInstanceOf(PsConstNode); expect(out[1]).toBeInstanceOf(PsConstNode);
expect(out[1].value).toBeFalse(); expect(out[1].value).toBeFalse();
}); });
@ -1427,7 +1427,7 @@ describe("PostScript Type 4 lexer, parser, and Wasm compiler", function () {
it("x or true → true", function () { it("x or true → true", function () {
const out = toTree("{ true or }", 1); const out = toTree("{ true or }", 1);
expect(out[0]).toBeInstanceOf(PsConstNode); expect(out[0]).toBeInstanceOf(PsConstNode);
expect(out[0].value).toBe(true); expect(out[0].value).toBeTrue();
}); });
// not(comparison) → negated comparison // not(comparison) → negated comparison
@ -1508,7 +1508,7 @@ describe("PostScript Type 4 lexer, parser, and Wasm compiler", function () {
it("x eq x → true (reflexive eq)", function () { it("x eq x → true (reflexive eq)", function () {
const out = toTree("{ dup eq }", 1); const out = toTree("{ dup eq }", 1);
expect(out[0]).toBeInstanceOf(PsConstNode); expect(out[0]).toBeInstanceOf(PsConstNode);
expect(out[0].value).toBe(true); expect(out[0].value).toBeTrue();
}); });
it("x and x → x (reflexive and)", function () { it("x and x → x (reflexive and)", function () {
@ -1626,7 +1626,7 @@ describe("PostScript Type 4 lexer, parser, and Wasm compiler", function () {
it("true or x → true (second=true or)", function () { it("true or x → true (second=true or)", function () {
const out = toTree("{ true exch or }", 1); const out = toTree("{ true exch or }", 1);
expect(out[0]).toBeInstanceOf(PsConstNode); expect(out[0]).toBeInstanceOf(PsConstNode);
expect(out[0].value).toBe(true); expect(out[0].value).toBeTrue();
}); });
it("no simplification when second operand is a non-special constant", function () { it("no simplification when second operand is a non-special constant", function () {
@ -1812,18 +1812,18 @@ describe("PostScript Type 4 lexer, parser, and Wasm compiler", function () {
}); });
it("constant-folds comparison operators", function () { it("constant-folds comparison operators", function () {
expect(toTree("{ 1 1 eq }", 0)[0].value).toBe(true); expect(toTree("{ 1 1 eq }", 0)[0].value).toBeTrue();
expect(toTree("{ 1 2 ne }", 0)[0].value).toBe(true); expect(toTree("{ 1 2 ne }", 0)[0].value).toBeTrue();
expect(toTree("{ 2 1 gt }", 0)[0].value).toBe(true); // a=2 > b=1 expect(toTree("{ 2 1 gt }", 0)[0].value).toBeTrue(); // a=2 > b=1
expect(toTree("{ 1 1 ge }", 0)[0].value).toBe(true); expect(toTree("{ 1 1 ge }", 0)[0].value).toBeTrue();
expect(toTree("{ 1 2 lt }", 0)[0].value).toBe(true); // a=1 < b=2 expect(toTree("{ 1 2 lt }", 0)[0].value).toBeTrue(); // a=1 < b=2
expect(toTree("{ 1 2 le }", 0)[0].value).toBe(true); expect(toTree("{ 1 2 le }", 0)[0].value).toBeTrue();
}); });
it("constant-folds boolean and, or, xor and bitshift", function () { it("constant-folds boolean and, or, xor and bitshift", function () {
expect(toTree("{ true false and }", 0)[0].value).toBeFalse(); expect(toTree("{ true false and }", 0)[0].value).toBeFalse();
expect(toTree("{ false true or }", 0)[0].value).toBe(true); expect(toTree("{ false true or }", 0)[0].value).toBeTrue();
expect(toTree("{ true false xor }", 0)[0].value).toBe(true); expect(toTree("{ true false xor }", 0)[0].value).toBeTrue();
expect(toTree("{ 4 2 bitshift }", 0)[0].value).toBe(16); // 4 << 2 expect(toTree("{ 4 2 bitshift }", 0)[0].value).toBe(16); // 4 << 2
}); });

View File

@ -586,20 +586,20 @@ describe("primitives", function () {
it("handles names", function () { it("handles names", function () {
const name = Name.get("Font"); const name = Name.get("Font");
expect(isName(name)).toEqual(true); expect(isName(name)).toBeTrue();
}); });
it("handles names with name check", function () { it("handles names with name check", function () {
const name = Name.get("Font"); const name = Name.get("Font");
expect(isName(name, "Font")).toEqual(true); expect(isName(name, "Font")).toBeTrue();
expect(isName(name, "Subtype")).toBeFalse(); expect(isName(name, "Subtype")).toBeFalse();
}); });
it("handles *empty* names, with name check", function () { it("handles *empty* names, with name check", function () {
const emptyName = Name.get(""); const emptyName = Name.get("");
expect(isName(emptyName)).toEqual(true); expect(isName(emptyName)).toBeTrue();
expect(isName(emptyName, "")).toEqual(true); expect(isName(emptyName, "")).toBeTrue();
expect(isName(emptyName, "string")).toBeFalse(); expect(isName(emptyName, "string")).toBeFalse();
}); });
@ -616,12 +616,12 @@ describe("primitives", function () {
it("handles commands", function () { it("handles commands", function () {
const cmd = Cmd.get("BT"); const cmd = Cmd.get("BT");
expect(isCmd(cmd)).toEqual(true); expect(isCmd(cmd)).toBeTrue();
}); });
it("handles commands with cmd check", function () { it("handles commands with cmd check", function () {
const cmd = Cmd.get("BT"); const cmd = Cmd.get("BT");
expect(isCmd(cmd, "BT")).toEqual(true); expect(isCmd(cmd, "BT")).toBeTrue();
expect(isCmd(cmd, "ET")).toBeFalse(); expect(isCmd(cmd, "ET")).toBeFalse();
}); });
@ -638,14 +638,14 @@ describe("primitives", function () {
it("handles empty dictionaries with type check", function () { it("handles empty dictionaries with type check", function () {
const dict = Dict.empty; const dict = Dict.empty;
expect(isDict(dict)).toEqual(true); expect(isDict(dict)).toBeTrue();
expect(isDict(dict, "Page")).toBeFalse(); expect(isDict(dict, "Page")).toBeFalse();
}); });
it("handles dictionaries with type check", function () { it("handles dictionaries with type check", function () {
const dict = new Dict(); const dict = new Dict();
dict.set("Type", Name.get("Page")); dict.set("Type", Name.get("Page"));
expect(isDict(dict, "Page")).toEqual(true); expect(isDict(dict, "Page")).toBeTrue();
expect(isDict(dict, "Contents")).toBeFalse(); expect(isDict(dict, "Contents")).toBeFalse();
}); });
@ -656,7 +656,7 @@ describe("primitives", function () {
it("should handle Refs pointing to the same object", function () { it("should handle Refs pointing to the same object", function () {
const ref1 = Ref.get(1, 0); const ref1 = Ref.get(1, 0);
const ref2 = Ref.get(1, 0); const ref2 = Ref.get(1, 0);
expect(isRefsEqual(ref1, ref2)).toEqual(true); expect(isRefsEqual(ref1, ref2)).toBeTrue();
}); });
it("should handle Refs pointing to different objects", function () { it("should handle Refs pointing to different objects", function () {

View File

@ -117,7 +117,7 @@ describe("Scripting", function () {
name: "Keystroke", name: "Keystroke",
willCommit: true, willCommit: true,
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
expect(send_queue.get(refId)).toEqual({ expect(send_queue.get(refId)).toEqual({
id: refId, id: refId,
siblings: null, siblings: null,
@ -356,7 +356,7 @@ describe("Scripting", function () {
willCommit: true, willCommit: true,
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
expect(send_queue.get(refId)).toEqual({ expect(send_queue.get(refId)).toEqual({
id: refId, id: refId,
value: "123", value: "123",
@ -392,7 +392,7 @@ describe("Scripting", function () {
selEnd: 4, selEnd: 4,
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
expect(send_queue.get(refId)).toEqual({ expect(send_queue.get(refId)).toEqual({
id: refId, id: refId,
siblings: null, siblings: null,
@ -430,7 +430,7 @@ describe("Scripting", function () {
selEnd: 4, selEnd: 4,
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
expect(send_queue.get(refId)).toEqual({ expect(send_queue.get(refId)).toEqual({
id: refId, id: refId,
siblings: null, siblings: null,
@ -504,7 +504,7 @@ describe("Scripting", function () {
willCommit: true, willCommit: true,
}); });
expect(send_queue.has(refId1)).toEqual(true); expect(send_queue.has(refId1)).toBeTrue();
expect(send_queue.get(refId1)).toEqual({ expect(send_queue.get(refId1)).toEqual({
id: refId1, id: refId1,
siblings: null, siblings: null,
@ -646,7 +646,7 @@ describe("Scripting", function () {
name: "Keystroke", name: "Keystroke",
willCommit: true, willCommit: true,
}); });
expect(send_queue.has("alert")).toEqual(true); expect(send_queue.has("alert")).toBeTrue();
expect(send_queue.get("alert")).toEqual({ expect(send_queue.get("alert")).toEqual({
command: "alert", command: "alert",
value: "hello", value: "hello",
@ -801,7 +801,7 @@ describe("Scripting", function () {
value: "0", value: "0",
name: "test1", name: "test1",
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
expect(send_queue.get(refId)).toEqual({ expect(send_queue.get(refId)).toEqual({
id: refId, id: refId,
value: "0.00€", value: "0.00€",
@ -813,7 +813,7 @@ describe("Scripting", function () {
value: "", value: "",
name: "test6", name: "test6",
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
expect(send_queue.get(refId)).toEqual({ expect(send_queue.get(refId)).toEqual({
id: refId, id: refId,
value: "0.00€", value: "0.00€",
@ -825,7 +825,7 @@ describe("Scripting", function () {
value: "123456.789", value: "123456.789",
name: "test1", name: "test1",
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
expect(send_queue.get(refId)).toEqual({ expect(send_queue.get(refId)).toEqual({
id: refId, id: refId,
value: "123,456.79€", value: "123,456.79€",
@ -837,7 +837,7 @@ describe("Scripting", function () {
value: "223456.789", value: "223456.789",
name: "test2", name: "test2",
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
expect(send_queue.get(refId)).toEqual({ expect(send_queue.get(refId)).toEqual({
id: refId, id: refId,
value: "$223456,8", value: "$223456,8",
@ -849,7 +849,7 @@ describe("Scripting", function () {
value: "-323456.789", value: "-323456.789",
name: "test3", name: "test3",
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
expect(send_queue.get(refId)).toEqual({ expect(send_queue.get(refId)).toEqual({
id: refId, id: refId,
value: "323,456.79€", value: "323,456.79€",
@ -862,7 +862,7 @@ describe("Scripting", function () {
value: "-423456.789", value: "-423456.789",
name: "test4", name: "test4",
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
expect(send_queue.get(refId)).toEqual({ expect(send_queue.get(refId)).toEqual({
id: refId, id: refId,
value: "(423,456.79€)", value: "(423,456.79€)",
@ -874,7 +874,7 @@ describe("Scripting", function () {
value: "-52345.678", value: "-52345.678",
name: "test5", name: "test5",
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
expect(send_queue.get(refId)).toEqual({ expect(send_queue.get(refId)).toEqual({
id: refId, id: refId,
value: "(52,345.68€)", value: "(52,345.68€)",
@ -914,7 +914,7 @@ describe("Scripting", function () {
name: "Keystroke", name: "Keystroke",
willCommit: true, willCommit: true,
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
expect(send_queue.get(refId)).toEqual({ expect(send_queue.get(refId)).toEqual({
id: refId, id: refId,
siblings: null, siblings: null,
@ -953,7 +953,7 @@ describe("Scripting", function () {
name: "Keystroke", name: "Keystroke",
willCommit: true, willCommit: true,
}); });
expect(send_queue.has("alert")).toEqual(true); expect(send_queue.has("alert")).toBeTrue();
expect(send_queue.get("alert")).toEqual({ expect(send_queue.get("alert")).toEqual({
command: "alert", command: "alert",
value: value:
@ -996,7 +996,7 @@ describe("Scripting", function () {
value: "0.456789", value: "0.456789",
name: "test1", name: "test1",
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
expect(send_queue.get(refId)).toEqual({ expect(send_queue.get(refId)).toEqual({
id: refId, id: refId,
value: "45.68%", value: "45.68%",
@ -1008,7 +1008,7 @@ describe("Scripting", function () {
value: "0.456789", value: "0.456789",
name: "test2", name: "test2",
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
expect(send_queue.get(refId)).toEqual({ expect(send_queue.get(refId)).toEqual({
id: refId, id: refId,
value: "%45.68", value: "%45.68",
@ -1046,7 +1046,7 @@ describe("Scripting", function () {
value: "Sun Apr 15 2007 03:14:15", value: "Sun Apr 15 2007 03:14:15",
name: "test1", name: "test1",
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
expect(send_queue.get(refId)).toEqual({ expect(send_queue.get(refId)).toEqual({
id: refId, id: refId,
value: "4/15", value: "4/15",
@ -1058,7 +1058,7 @@ describe("Scripting", function () {
value: "Sun Apr 15 2007 03:14:15", value: "Sun Apr 15 2007 03:14:15",
name: "test2", name: "test2",
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
expect(send_queue.get(refId)).toEqual({ expect(send_queue.get(refId)).toEqual({
id: refId, id: refId,
value: "4/15/07 3:14 am", value: "4/15/07 3:14 am",
@ -1093,7 +1093,7 @@ describe("Scripting", function () {
name: "Keystroke", name: "Keystroke",
willCommit: true, willCommit: true,
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
expect(send_queue.get(refId)).toEqual({ expect(send_queue.get(refId)).toEqual({
id: refId, id: refId,
siblings: null, siblings: null,
@ -1108,7 +1108,7 @@ describe("Scripting", function () {
name: "Keystroke", name: "Keystroke",
willCommit: true, willCommit: true,
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
expect(send_queue.get(refId)).toEqual({ expect(send_queue.get(refId)).toEqual({
id: refId, id: refId,
siblings: null, siblings: null,
@ -1124,7 +1124,7 @@ describe("Scripting", function () {
name: "Keystroke", name: "Keystroke",
willCommit: true, willCommit: true,
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
expect(send_queue.get(refId)).toEqual({ expect(send_queue.get(refId)).toEqual({
id: refId, id: refId,
siblings: null, siblings: null,
@ -1140,7 +1140,7 @@ describe("Scripting", function () {
name: "Keystroke", name: "Keystroke",
willCommit: true, willCommit: true,
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
expect(send_queue.get(refId)).toEqual({ expect(send_queue.get(refId)).toEqual({
id: refId, id: refId,
siblings: null, siblings: null,
@ -1179,7 +1179,7 @@ describe("Scripting", function () {
name: "Keystroke", name: "Keystroke",
willCommit: true, willCommit: true,
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
expect(send_queue.get(refId)).toEqual({ expect(send_queue.get(refId)).toEqual({
id: refId, id: refId,
siblings: null, siblings: null,
@ -1215,7 +1215,7 @@ describe("Scripting", function () {
name: "Keystroke", name: "Keystroke",
willCommit: true, willCommit: true,
}); });
expect(send_queue.has("alert")).toEqual(true); expect(send_queue.has("alert")).toBeTrue();
expect(send_queue.get("alert")).toEqual({ expect(send_queue.get("alert")).toEqual({
command: "alert", command: "alert",
value: value:
@ -1290,7 +1290,7 @@ describe("Scripting", function () {
name: "Keystroke", name: "Keystroke",
willCommit: true, willCommit: true,
}); });
expect(send_queue.has(refIds[3])).toEqual(true); expect(send_queue.has(refIds[3])).toBeTrue();
expect(send_queue.get(refIds[3])).toEqual({ expect(send_queue.get(refIds[3])).toEqual({
id: refIds[3], id: refIds[3],
siblings: null, siblings: null,
@ -1304,7 +1304,7 @@ describe("Scripting", function () {
name: "Keystroke", name: "Keystroke",
willCommit: true, willCommit: true,
}); });
expect(send_queue.has(refIds[3])).toEqual(true); expect(send_queue.has(refIds[3])).toBeTrue();
expect(send_queue.get(refIds[3])).toEqual({ expect(send_queue.get(refIds[3])).toEqual({
id: refIds[3], id: refIds[3],
siblings: null, siblings: null,
@ -1318,7 +1318,7 @@ describe("Scripting", function () {
name: "Keystroke", name: "Keystroke",
willCommit: true, willCommit: true,
}); });
expect(send_queue.has(refIds[3])).toEqual(true); expect(send_queue.has(refIds[3])).toBeTrue();
expect(send_queue.get(refIds[3])).toEqual({ expect(send_queue.get(refIds[3])).toEqual({
id: refIds[3], id: refIds[3],
siblings: null, siblings: null,
@ -1326,7 +1326,7 @@ describe("Scripting", function () {
formattedValue: null, formattedValue: null,
}); });
expect(send_queue.has(refIds[4])).toEqual(true); expect(send_queue.has(refIds[4])).toBeTrue();
expect(send_queue.get(refIds[4])).toEqual({ expect(send_queue.get(refIds[4])).toEqual({
id: refIds[4], id: refIds[4],
siblings: null, siblings: null,
@ -1396,7 +1396,7 @@ describe("Scripting", function () {
name: "Keystroke", name: "Keystroke",
willCommit: true, willCommit: true,
}); });
expect(send_queue.has(refIds[5])).toEqual(true); expect(send_queue.has(refIds[5])).toBeTrue();
expect(send_queue.get(refIds[5])).toEqual({ expect(send_queue.get(refIds[5])).toEqual({
id: refIds[5], id: refIds[5],
siblings: null, siblings: null,
@ -1410,7 +1410,7 @@ describe("Scripting", function () {
name: "Keystroke", name: "Keystroke",
willCommit: true, willCommit: true,
}); });
expect(send_queue.has(refIds[5])).toEqual(true); expect(send_queue.has(refIds[5])).toBeTrue();
expect(send_queue.get(refIds[5])).toEqual({ expect(send_queue.get(refIds[5])).toEqual({
id: refIds[5], id: refIds[5],
siblings: null, siblings: null,
@ -1484,7 +1484,7 @@ describe("Scripting", function () {
name: "Keystroke", name: "Keystroke",
willCommit: true, willCommit: true,
}); });
expect(send_queue.has(refIds[3])).toEqual(true); expect(send_queue.has(refIds[3])).toBeTrue();
expect(send_queue.get(refIds[3])).toEqual({ expect(send_queue.get(refIds[3])).toEqual({
id: refIds[3], id: refIds[3],
siblings: null, siblings: null,
@ -1498,7 +1498,7 @@ describe("Scripting", function () {
name: "Keystroke", name: "Keystroke",
willCommit: true, willCommit: true,
}); });
expect(send_queue.has(refIds[3])).toEqual(true); expect(send_queue.has(refIds[3])).toBeTrue();
expect(send_queue.get(refIds[3])).toEqual({ expect(send_queue.get(refIds[3])).toEqual({
id: refIds[3], id: refIds[3],
siblings: null, siblings: null,
@ -1512,7 +1512,7 @@ describe("Scripting", function () {
name: "Keystroke", name: "Keystroke",
willCommit: true, willCommit: true,
}); });
expect(send_queue.has(refIds[3])).toEqual(true); expect(send_queue.has(refIds[3])).toBeTrue();
expect(send_queue.get(refIds[3])).toEqual({ expect(send_queue.get(refIds[3])).toEqual({
id: refIds[3], id: refIds[3],
siblings: null, siblings: null,
@ -1520,7 +1520,7 @@ describe("Scripting", function () {
formattedValue: null, formattedValue: null,
}); });
expect(send_queue.has(refIds[4])).toEqual(true); expect(send_queue.has(refIds[4])).toBeTrue();
expect(send_queue.get(refIds[4])).toEqual({ expect(send_queue.get(refIds[4])).toEqual({
id: refIds[4], id: refIds[4],
siblings: null, siblings: null,
@ -1560,7 +1560,7 @@ describe("Scripting", function () {
selStart: 0, selStart: 0,
selEnd: 0, selEnd: 0,
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
send_queue.delete(refId); send_queue.delete(refId);
await sandbox.dispatchEventInSandbox({ await sandbox.dispatchEventInSandbox({
@ -1572,7 +1572,7 @@ describe("Scripting", function () {
selStart: 1, selStart: 1,
selEnd: 1, selEnd: 1,
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
send_queue.delete(refId); send_queue.delete(refId);
await sandbox.dispatchEventInSandbox({ await sandbox.dispatchEventInSandbox({
@ -1584,7 +1584,7 @@ describe("Scripting", function () {
selStart: 2, selStart: 2,
selEnd: 2, selEnd: 2,
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
send_queue.delete(refId); send_queue.delete(refId);
await sandbox.dispatchEventInSandbox({ await sandbox.dispatchEventInSandbox({
@ -1596,7 +1596,7 @@ describe("Scripting", function () {
selStart: 3, selStart: 3,
selEnd: 3, selEnd: 3,
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
expect(send_queue.get(refId)).toEqual({ expect(send_queue.get(refId)).toEqual({
id: refId, id: refId,
siblings: null, siblings: null,
@ -1614,7 +1614,7 @@ describe("Scripting", function () {
selStart: 3, selStart: 3,
selEnd: 3, selEnd: 3,
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
send_queue.delete(refId); send_queue.delete(refId);
await sandbox.dispatchEventInSandbox({ await sandbox.dispatchEventInSandbox({
@ -1625,7 +1625,7 @@ describe("Scripting", function () {
selStart: 4, selStart: 4,
selEnd: 4, selEnd: 4,
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
expect(send_queue.get(refId)).toEqual({ expect(send_queue.get(refId)).toEqual({
id: refId, id: refId,
siblings: null, siblings: null,
@ -1672,7 +1672,7 @@ describe("Scripting", function () {
selStart: i, selStart: i,
selEnd: i, selEnd: i,
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
send_queue.delete(refId); send_queue.delete(refId);
value += change; value += change;
} }
@ -1686,7 +1686,7 @@ describe("Scripting", function () {
selStart: i, selStart: i,
selEnd: i, selEnd: i,
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
expect(send_queue.get(refId)).toEqual({ expect(send_queue.get(refId)).toEqual({
id: refId, id: refId,
siblings: null, siblings: null,
@ -1733,7 +1733,7 @@ describe("Scripting", function () {
selStart: i, selStart: i,
selEnd: i, selEnd: i,
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
send_queue.delete(refId); send_queue.delete(refId);
value += change; value += change;
} }
@ -1747,7 +1747,7 @@ describe("Scripting", function () {
selStart: i, selStart: i,
selEnd: i, selEnd: i,
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
expect(send_queue.get(refId)).toEqual({ expect(send_queue.get(refId)).toEqual({
id: refId, id: refId,
siblings: null, siblings: null,
@ -1794,7 +1794,7 @@ describe("Scripting", function () {
selStart: i, selStart: i,
selEnd: i, selEnd: i,
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
send_queue.delete(refId); send_queue.delete(refId);
value += change; value += change;
} }
@ -1808,7 +1808,7 @@ describe("Scripting", function () {
selStart: i, selStart: i,
selEnd: i, selEnd: i,
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
expect(send_queue.get(refId)).toEqual({ expect(send_queue.get(refId)).toEqual({
id: refId, id: refId,
siblings: null, siblings: null,
@ -1855,7 +1855,7 @@ describe("Scripting", function () {
selStart: i, selStart: i,
selEnd: i, selEnd: i,
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
send_queue.delete(refId); send_queue.delete(refId);
value += change; value += change;
} }
@ -1869,7 +1869,7 @@ describe("Scripting", function () {
selStart: i, selStart: i,
selEnd: i, selEnd: i,
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
expect(send_queue.get(refId)).toEqual({ expect(send_queue.get(refId)).toEqual({
id: refId, id: refId,
siblings: null, siblings: null,
@ -1916,7 +1916,7 @@ describe("Scripting", function () {
selStart: i, selStart: i,
selEnd: i, selEnd: i,
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
send_queue.delete(refId); send_queue.delete(refId);
value += change; value += change;
} }
@ -1930,7 +1930,7 @@ describe("Scripting", function () {
selStart: i, selStart: i,
selEnd: i, selEnd: i,
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
expect(send_queue.get(refId)).toEqual({ expect(send_queue.get(refId)).toEqual({
id: refId, id: refId,
siblings: null, siblings: null,
@ -1977,7 +1977,7 @@ describe("Scripting", function () {
selStart: i, selStart: i,
selEnd: i, selEnd: i,
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
send_queue.delete(refId); send_queue.delete(refId);
value += change; value += change;
} }
@ -1991,7 +1991,7 @@ describe("Scripting", function () {
selStart: i, selStart: i,
selEnd: i, selEnd: i,
}); });
expect(send_queue.has(refId)).toEqual(true); expect(send_queue.has(refId)).toBeTrue();
expect(send_queue.get(refId)).toEqual({ expect(send_queue.get(refId)).toEqual({
id: refId, id: refId,
siblings: null, siblings: null,
@ -2009,7 +2009,7 @@ describe("Scripting", function () {
expect(value).toBeFalse(); expect(value).toBeFalse();
value = await myeval(`eMailValidate("foo@bar.com")`); value = await myeval(`eMailValidate("foo@bar.com")`);
expect(value).toEqual(true); expect(value).toBeTrue();
value = await myeval(`eMailValidate("foo bar")`); value = await myeval(`eMailValidate("foo bar")`);
expect(value).toBeFalse(); expect(value).toBeFalse();
@ -2019,7 +2019,7 @@ describe("Scripting", function () {
describe("AFExactMatch", function () { describe("AFExactMatch", function () {
it("should check matching between regexs and a string", async () => { it("should check matching between regexs and a string", async () => {
let value = await myeval(`AFExactMatch(/\\d+/, "123")`); let value = await myeval(`AFExactMatch(/\\d+/, "123")`);
expect(value).toEqual(true); expect(value).toBeTrue();
value = await myeval(`AFExactMatch(/\\d+/, "foo")`); value = await myeval(`AFExactMatch(/\\d+/, "foo")`);
expect(value).toEqual(0); expect(value).toEqual(0);

View File

@ -23,12 +23,12 @@ import {
describe("string_utils", function () { describe("string_utils", function () {
describe("isAscii", function () { describe("isAscii", function () {
it("handles ascii/non-ascii strings", function () { it("handles ascii/non-ascii strings", function () {
expect(isAscii("hello world")).toEqual(true); expect(isAscii("hello world")).toBeTrue();
expect(isAscii("こんにちは世界の")).toBeFalse(); expect(isAscii("こんにちは世界の")).toBeFalse();
expect(isAscii("hello world in Japanese is こんにちは世界の")).toEqual( expect(isAscii("hello world in Japanese is こんにちは世界の")).toEqual(
false false
); );
expect(isAscii("")).toEqual(true); expect(isAscii("")).toBeTrue();
expect(isAscii(123)).toBeFalse(); expect(isAscii(123)).toBeFalse();
expect(isAscii(null)).toBeFalse(); expect(isAscii(null)).toBeFalse();
expect(isAscii(undefined)).toBeFalse(); expect(isAscii(undefined)).toBeFalse();

View File

@ -75,10 +75,10 @@ describe("ui_utils", function () {
}); });
it("should accept valid angles", function () { it("should accept valid angles", function () {
expect(isValidRotation(0)).toEqual(true); expect(isValidRotation(0)).toBeTrue();
expect(isValidRotation(90)).toEqual(true); expect(isValidRotation(90)).toBeTrue();
expect(isValidRotation(-270)).toEqual(true); expect(isValidRotation(-270)).toBeTrue();
expect(isValidRotation(540)).toEqual(true); expect(isValidRotation(540)).toBeTrue();
}); });
}); });
@ -89,14 +89,14 @@ describe("ui_utils", function () {
width: 200, width: 200,
height: 400, height: 400,
}) })
).toEqual(true); ).toBeTrue();
expect( expect(
isPortraitOrientation({ isPortraitOrientation({
width: 500, width: 500,
height: 500, height: 500,
}) })
).toEqual(true); ).toBeTrue();
}); });
it("should be landscape orientation", function () { it("should be landscape orientation", function () {

View File

@ -247,7 +247,7 @@ describe("FormCalc expression parser", function () {
operand: { id: "こんにちは世界" }, operand: { id: "こんにちは世界" },
index: -0, index: -0,
}); });
expect(Object.is(-0, dump.index)).toBe(true); expect(Object.is(-0, dump.index)).toBeTrue();
parser = new Parser(`こんにちは世界[+0]`); parser = new Parser(`こんにちは世界[+0]`);
dump = parser.parse().dump()[0]; dump = parser.parse().dump()[0];
@ -255,7 +255,7 @@ describe("FormCalc expression parser", function () {
operand: { id: "こんにちは世界" }, operand: { id: "こんにちは世界" },
index: +0, index: +0,
}); });
expect(Object.is(+0, dump.index)).toBe(true); expect(Object.is(+0, dump.index)).toBeTrue();
parser = new Parser(`こんにちは世界[*]`); parser = new Parser(`こんにちは世界[*]`);
expect(parser.parse().dump()[0]).toEqual({ expect(parser.parse().dump()[0]).toEqual({
@ -267,7 +267,7 @@ describe("FormCalc expression parser", function () {
it("should parse basic expression with dots", function () { it("should parse basic expression with dots", function () {
const parser = new Parser("a.b.c.#d..e.f..g.*"); const parser = new Parser("a.b.c.#d..e.f..g.*");
const exprlist = parser.parse(); const exprlist = parser.parse();
expect(exprlist.expressions[0].isDotExpression()).toEqual(true); expect(exprlist.expressions[0].isDotExpression()).toBeTrue();
expect(exprlist.dump()[0]).toEqual({ expect(exprlist.dump()[0]).toEqual({
operator: ".", operator: ".",
left: { id: "a" }, left: { id: "a" },
@ -733,8 +733,8 @@ endfunc
it("should parse som predicate", () => { it("should parse som predicate", () => {
const parser = new Parser("a.b <= 3"); const parser = new Parser("a.b <= 3");
const expr = parser.parse().expressions[0]; const expr = parser.parse().expressions[0];
expect(expr.isSomPredicate()).toEqual(true); expect(expr.isSomPredicate()).toBeTrue();
expect(expr.left.isSomPredicate()).toEqual(true); expect(expr.left.isSomPredicate()).toBeTrue();
}); });
}); });
}); });

View File

@ -642,7 +642,7 @@ describe("XFAFactory", function () {
const pages = await factory.getPages(); const pages = await factory.getPages();
let a = searchHtmlNode(pages, "name", "a"); let a = searchHtmlNode(pages, "name", "a");
expect(a.attributes.href).toEqual("https://github.com/mozilla/pdf.js"); expect(a.attributes.href).toEqual("https://github.com/mozilla/pdf.js");
expect(a.attributes.newWindow).toEqual(true); expect(a.attributes.newWindow).toBeTrue();
a = searchHtmlNode(pages, "name", "a", false, [1]); a = searchHtmlNode(pages, "name", "a", false, [1]);
expect(a.attributes.href).toEqual("https://github.com/allizom/pdf.js"); expect(a.attributes.href).toEqual("https://github.com/allizom/pdf.js");