Skip to content

Commit

Permalink
Fix node bindgins tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dmtrKovalenko committed Apr 29, 2024
1 parent 490faad commit b81400a
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions test/node-binding.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ test("Outputs correct parsed result when images different", async (t) => {
);

t.is(reason, "pixel-diff");
t.is(diffCount, 109861);
t.is(diffPercentage, 2.85952484323);
t.is(diffCount, 101841);
t.is(diffPercentage, 2.65077570347);
})

test("Correctly works with reduceRamUsage", async (t) => {
Expand All @@ -45,34 +45,40 @@ test("Correctly works with reduceRamUsage", async (t) => {
);

t.is(reason, "pixel-diff");
t.is(diffCount, 109861);
t.is(diffPercentage, 2.85952484323);
t.is(diffCount, 101841);
t.is(diffPercentage, 2.65077570347);
});

test("Correctly parses threshold", async (t) => {
const { reason, diffCount, diffPercentage } = await compare(
path.join(IMAGES_PATH, "donkey.png"),
path.join(IMAGES_PATH, "donkey-2.png"),
path.join(IMAGES_PATH, "diff.png"),
options
{
...options,
threshold: 0.5,
}
);

t.is(reason, "pixel-diff");
t.is(diffCount, 50332);
t.is(diffPercentage, 1.31007003768);
t.is(diffCount, 65357);
t.is(diffPercentage, 1.70114931758);
});

test("Correctly parses antialiasing", async (t) => {
const { reason, diffCount, diffPercentage } = await compare(
path.join(IMAGES_PATH, "donkey.png"),
path.join(IMAGES_PATH, "donkey-2.png"),
path.join(IMAGES_PATH, "diff.png"),
options
{
...options,
antialiasing: true,
}
);

t.is(reason, "pixel-diff");
t.is(diffCount, 108208);
t.is(diffPercentage, 2.8164996153);
t.is(diffCount, 101499);
t.is(diffPercentage, 2.64187393218);
});

test("Correctly parses ignore regions", async (t) => {
Expand Down Expand Up @@ -138,7 +144,7 @@ test("Correctly outputs diff lines", async (t) => {
);

t.is(match, false);
t.is(diffLines.length, 411);
t.is(diffLines.length, 402);
});

test("Returns meaningful error if file does not exist and noFailOnFsErrors", async (t) => {
Expand Down

0 comments on commit b81400a

Please sign in to comment.