Skip to content

Commit f751a43

Browse files
committed
Remove type assertion in getAsciiArt test
1 parent 15683a5 commit f751a43

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

cli/node.test.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,30 @@ Deno.test("rgbTo256Color - check grayscale", () => {
154154
assertEquals(results, EXPECTED_GRAY_IDX);
155155
});
156156

157-
Deno.test("getAsciiArt - Darkest Letter", () => {
157+
Deno.test("getAsciiArt - Darkest Letter", async () => {
158158
// Create black and white 1x1 images using Jimp constructor
159159
const blackImage = new Jimp({ width: 1, height: 1, color: 0x000000ff });
160+
const blackImageBuffer = await blackImage.getBuffer("image/webp");
160161

161162
const blackResult = getAsciiArt(
162-
blackImage as unknown as Parameters<typeof getAsciiArt>[0],
163+
await Jimp.read(blackImageBuffer),
163164
1,
164165
true,
165166
);
166167

167-
assertEquals(blackResult.includes("█"), true);
168+
assertEquals(blackResult, "█");
169+
});
170+
171+
Deno.test("getAsciiArt - Brightest Letter", async () => {
172+
// Create black and white 1x1 images using Jimp constructor
173+
const whiteImage = new Jimp({ width: 1, height: 1, color: 0xffffffff });
174+
const whiteImageBuffer = await whiteImage.getBuffer("image/webp");
175+
176+
const whiteResult = getAsciiArt(
177+
await Jimp.read(whiteImageBuffer),
178+
1,
179+
true,
180+
);
181+
182+
assertEquals(whiteResult, " ");
168183
});

0 commit comments

Comments
 (0)