Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'bpisano-invalid-image-format-fix'
  • Loading branch information
jamescryer committed Feb 24, 2022
2 parents 00b7154 + 4a027de commit 303e604
Show file tree
Hide file tree
Showing 5 changed files with 5,871 additions and 37 deletions.
8 changes: 7 additions & 1 deletion nodejs-tests/compareImages.test.js
Expand Up @@ -34,7 +34,13 @@ describe("compareImages", () => {

test("throws when failed", async () => {
const promise = compareImages(fs.readFileSync("./demoassets/People.jpg"), "bogus data");
await expect(promise).rejects.toMatch("Error: ENOENT, No such file or directory 'bogus data'");
await expect(promise).rejects.toMatch("Failed to load image 'bogus data'. Error: ENOENT, No such file or directory 'bogus data'");
});

test("throws when invalid image format", async () => {
const invalidImageFormat = "data:,";
const promise = compareImages(invalidImageFormat, fs.readFileSync("./demoassets/People.jpg"));
await expect(promise).rejects.toMatch("Failed to load image 'data:,'. Error: Unsupported image type");
});

test("returns early", async () => {
Expand Down
4 changes: 3 additions & 1 deletion nodejs-tests/resemble.test.js
Expand Up @@ -57,7 +57,9 @@ describe("resemble", () => {
resemble("../demoassets/People.jpg")
.compareTo("../demoassets/404-image.jpg")
.onComplete((data) => {
expect(data.error).toEqual("Error: ENOENT, No such file or directory '../demoassets/People.jpg'");
expect(data.error).toEqual(
"Failed to load image '../demoassets/People.jpg'. Error: ENOENT, No such file or directory '../demoassets/People.jpg'"
);
resolve();
});
}));
Expand Down

0 comments on commit 303e604

Please sign in to comment.