From b7c4eb597260d25e7d2e18e6d6821ad034526607 Mon Sep 17 00:00:00 2001 From: Andrew Michael McNutt Date: Mon, 11 Mar 2024 14:35:45 -0700 Subject: [PATCH] fix tests --- public/lang-docs.md | 2 +- src/lib/ColorLint.test.ts | 2 +- src/lib/__snapshots__/ColorLint.test.ts.snap | 8 ++++---- src/lib/__snapshots__/LintDocs.test.ts.snap | 2 +- src/lib/lint-language/LintLanguage.test.ts | 10 ++++------ 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/public/lang-docs.md b/public/lang-docs.md index c748c578..b6f81b6b 100644 --- a/public/lang-docs.md +++ b/public/lang-docs.md @@ -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 diff --git a/src/lib/ColorLint.test.ts b/src/lib/ColorLint.test.ts index 87214ade..adaef23d 100644 --- a/src/lib/ColorLint.test.ts +++ b/src/lib/ColorLint.test.ts @@ -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)", ]); }); diff --git a/src/lib/__snapshots__/ColorLint.test.ts.snap b/src/lib/__snapshots__/ColorLint.test.ts.snap index 5a38794b..7f918c79 100644 --- a/src/lib/__snapshots__/ColorLint.test.ts.snap +++ b/src/lib/__snapshots__/ColorLint.test.ts.snap @@ -16,11 +16,11 @@ exports[`ColorLint - Background Contrast 1`] = ` exports[`ColorLint - Background Contrast 2`] = ` [ - "#007070", + "#006f70", "#006f72", "#006e7e", "#fdfdfc", - "#007070", + "#006f70", ] `; @@ -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."`; diff --git a/src/lib/__snapshots__/LintDocs.test.ts.snap b/src/lib/__snapshots__/LintDocs.test.ts.snap index 7ab60119..dba0065b 100644 --- a/src/lib/__snapshots__/LintDocs.test.ts.snap +++ b/src/lib/__snapshots__/LintDocs.test.ts.snap @@ -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 diff --git a/src/lib/lint-language/LintLanguage.test.ts b/src/lib/lint-language/LintLanguage.test.ts index e3c3758c..7121f807 100644 --- a/src/lib/lint-language/LintLanguage.test.ts +++ b/src/lib/lint-language/LintLanguage.test.ts @@ -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([]); }); @@ -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([]);