Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mcnuttandrew committed Mar 11, 2024
1 parent f5e2170 commit b7c4eb5
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion public/lang-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -1211,7 +1211,7 @@ Natural Language: ALL a in colors, inGamut(a) == TRUE

Palettes that will fail this test:

- #0087a5 with a #fff background
- #00808a with a #fff background



Expand Down
2 changes: 1 addition & 1 deletion src/lib/ColorLint.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ test("ColorLint - Gamut", async () => {

const fix = await suggestLintFix(examplePal, exampleLint);
expect(fix[0].colors.map((x) => x.toString())).toStrictEqual([
"lab(51.296% -23.327 -25.373)",
"lab(48.319% -27.81 -14.373)",
]);
});

Expand Down
8 changes: 4 additions & 4 deletions src/lib/__snapshots__/ColorLint.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ exports[`ColorLint - Background Contrast 1`] = `

exports[`ColorLint - Background Contrast 2`] = `
[
"#007070",
"#006f70",
"#006f72",
"#006e7e",
"#fdfdfc",
"#007070",
"#006f70",
]
`;

Expand Down Expand Up @@ -68,9 +68,9 @@ exports[`ColorLint - Fair Sequential 2`] = `"This palette is unfair (meaning tha

exports[`ColorLint - Gamut 1`] = `"A color or colors is not in the sRGB gamut (). Please adjust the color so that it can be displayed on most devices."`;

exports[`ColorLint - Gamut 2`] = `"A color or colors is not in the sRGB gamut (#0087a5). Please adjust the color so that it can be displayed on most devices."`;
exports[`ColorLint - Gamut 2`] = `"A color or colors is not in the sRGB gamut (#00808a). Please adjust the color so that it can be displayed on most devices."`;

exports[`ColorLint - Gamut 3`] = `"A color or colors is not in the sRGB gamut (#0087a5). Please adjust the color so that it can be displayed on most devices."`;
exports[`ColorLint - Gamut 3`] = `"A color or colors is not in the sRGB gamut (#00808a). Please adjust the color so that it can be displayed on most devices."`;

exports[`ColorLint - MaxColors 1`] = `"This palette has too many colors and may be hard to discriminate in some contexts. Maximum: 10."`;

Expand Down
2 changes: 1 addition & 1 deletion src/lib/__snapshots__/LintDocs.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1214,7 +1214,7 @@ Natural Language: ALL a in colors, inGamut(a) == TRUE
Palettes that will fail this test:
- #0087a5 with a #fff background
- #00808a with a #fff background
Expand Down
10 changes: 4 additions & 6 deletions src/lib/lint-language/LintLanguage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -508,13 +508,11 @@ test("LintLanguage Measure DeltaE", () => {
deltaE: { left: colors[0], right: colors[1] },
algorithm: "2000",
},
right: 100.00000248106656,
right: 100,
},
};
const result = LLEval(program, toPal([]), { debugCompare: false });
expect(prettyPrintLL(program)).toBe(
"deltaE(#000, #fff, 2000) == 100.00000248106656"
);
expect(prettyPrintLL(program)).toBe("deltaE(#000, #fff, 2000) == 100");
expect(result.result).toBe(true);
expect(result.blame).toStrictEqual([]);
});
Expand All @@ -527,12 +525,12 @@ test("LintLanguage Measure Contrast", () => {
contrast: { left: colors[0], right: colors[1] },
algorithm: "APCA",
},
right: 107.88473522404158,
right: 107.88473318309843,
},
};
const result = LLEval(program, [] as any);
expect(prettyPrintLL(program)).toBe(
"contrast(#000, #fff, APCA) == 107.88473522404158"
"contrast(#000, #fff, APCA) == 107.88473318309843"
);
expect(result.result).toBe(true);
expect(result.blame).toStrictEqual([]);
Expand Down

0 comments on commit b7c4eb5

Please sign in to comment.