Skip to content

Commit

Permalink
further ocr-engine-test style fixes (#56)
Browse files Browse the repository at this point in the history
As recommended by biome. These are fixes that could not be applied automatically.
  • Loading branch information
wydengyre authored Jun 15, 2024
1 parent 5fe88b5 commit dfa08d0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/ocr-engine-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe("OCREngine", () => {
ocr.destroy();
});

[
for (const [imageData, expectedError] of [
// Image size does not match buffer size
[
{
Expand All @@ -80,7 +80,7 @@ describe("OCREngine", () => {

// Zero height image
[emptyImage(100, 0), "Image width or height is zero"],
].forEach(([imageData, expectedError]) => {
]) {
it("throws an error if image fails to load", () => {
assert.throws(
() => {
Expand All @@ -90,7 +90,7 @@ describe("OCREngine", () => {
undefined,
);
});
});
}

it("throws an error if OCR is attempted before image is loaded", async () => {
const ocr = await createEngine();
Expand Down Expand Up @@ -246,11 +246,11 @@ describe("OCREngine", () => {
assert.strict(meanConfidence2 >= 0.9);
});

[
for (const [width, height] of [
[100, 100],
[200, 200],
[1, 1],
].forEach(([width, height]) => {
]) {
it("extracts bounding boxes for empty image", async () => {
ocr.loadImage(emptyImage(width, height));
const wordBoxes = ocr.getBoundingBoxes("word");
Expand All @@ -264,7 +264,7 @@ describe("OCREngine", () => {
const wordBoxes = ocr.getTextBoxes("word");
assert.strictEqual(wordBoxes.length, 1);
});
});
}

it("extracts layout flags from image", { timeout: 5_000 }, async () => {
const imageData = await loadImage(resolve("./small-test-page.jpg"));
Expand Down

0 comments on commit dfa08d0

Please sign in to comment.