Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fixed CI + added test for invalid image format + upgraded canvas to 2…
….9.0
  • Loading branch information
bpisano committed Jan 25, 2022
1 parent 5e643ae commit 50a7390
Show file tree
Hide file tree
Showing 5 changed files with 6,317 additions and 830 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 50a7390

Please sign in to comment.