Switch to double quotes and reformat codebase with Biome
This commit is contained in:
@@ -2,7 +2,14 @@ import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
||||
import { mkdtempSync, rmSync, writeFileSync, mkdirSync, realpathSync } from "fs";
|
||||
import { join } from "path";
|
||||
import { tmpdir } from "os";
|
||||
import { findProjectIcon, getProjectIcon, ICON_PATTERNS, PRIORITY_DIRS, IGNORED_DIRS, MONOREPO_PACKAGE_DIRS } from "./project-icon.js";
|
||||
import {
|
||||
findProjectIcon,
|
||||
getProjectIcon,
|
||||
ICON_PATTERNS,
|
||||
PRIORITY_DIRS,
|
||||
IGNORED_DIRS,
|
||||
MONOREPO_PACKAGE_DIRS,
|
||||
} from "./project-icon.js";
|
||||
|
||||
function createTempDir(): string {
|
||||
return realpathSync(mkdtempSync(join(tmpdir(), "project-icon-test-")));
|
||||
@@ -262,33 +269,112 @@ describe("getProjectIcon", () => {
|
||||
|
||||
// Valid 1x1 PNG (square)
|
||||
const squarePng = Buffer.from([
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, // PNG signature
|
||||
0x00, 0x00, 0x00, 0x0d, // IHDR chunk length
|
||||
0x49, 0x48, 0x44, 0x52, // IHDR
|
||||
0x00, 0x00, 0x00, 0x01, // width: 1
|
||||
0x00, 0x00, 0x00, 0x01, // height: 1
|
||||
0x08, 0x02, // bit depth, color type
|
||||
0x00, 0x00, 0x00, // compression, filter, interlace
|
||||
0x90, 0x77, 0x53, 0xde, // CRC
|
||||
0x00, 0x00, 0x00, 0x0c, // IDAT chunk length
|
||||
0x49, 0x44, 0x41, 0x54, // IDAT
|
||||
0x08, 0xd7, 0x63, 0xf8, 0xff, 0xff, 0xff, 0x00, 0x05, 0xfe, 0x02, 0xfe, // data
|
||||
0xa3, 0x6c, 0x47, 0x9f, // CRC
|
||||
0x00, 0x00, 0x00, 0x00, // IEND chunk length
|
||||
0x49, 0x45, 0x4e, 0x44, // IEND
|
||||
0xae, 0x42, 0x60, 0x82, // CRC
|
||||
0x89,
|
||||
0x50,
|
||||
0x4e,
|
||||
0x47,
|
||||
0x0d,
|
||||
0x0a,
|
||||
0x1a,
|
||||
0x0a, // PNG signature
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x0d, // IHDR chunk length
|
||||
0x49,
|
||||
0x48,
|
||||
0x44,
|
||||
0x52, // IHDR
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x01, // width: 1
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x01, // height: 1
|
||||
0x08,
|
||||
0x02, // bit depth, color type
|
||||
0x00,
|
||||
0x00,
|
||||
0x00, // compression, filter, interlace
|
||||
0x90,
|
||||
0x77,
|
||||
0x53,
|
||||
0xde, // CRC
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x0c, // IDAT chunk length
|
||||
0x49,
|
||||
0x44,
|
||||
0x41,
|
||||
0x54, // IDAT
|
||||
0x08,
|
||||
0xd7,
|
||||
0x63,
|
||||
0xf8,
|
||||
0xff,
|
||||
0xff,
|
||||
0xff,
|
||||
0x00,
|
||||
0x05,
|
||||
0xfe,
|
||||
0x02,
|
||||
0xfe, // data
|
||||
0xa3,
|
||||
0x6c,
|
||||
0x47,
|
||||
0x9f, // CRC
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00, // IEND chunk length
|
||||
0x49,
|
||||
0x45,
|
||||
0x4e,
|
||||
0x44, // IEND
|
||||
0xae,
|
||||
0x42,
|
||||
0x60,
|
||||
0x82, // CRC
|
||||
]);
|
||||
|
||||
// Valid 2x1 PNG (non-square)
|
||||
const nonSquarePng = Buffer.from([
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, // PNG signature
|
||||
0x00, 0x00, 0x00, 0x0d, // IHDR chunk length
|
||||
0x49, 0x48, 0x44, 0x52, // IHDR
|
||||
0x00, 0x00, 0x00, 0x02, // width: 2
|
||||
0x00, 0x00, 0x00, 0x01, // height: 1
|
||||
0x08, 0x02, // bit depth, color type
|
||||
0x00, 0x00, 0x00, // compression, filter, interlace
|
||||
0x00, 0x00, 0x00, 0x00, // CRC (not validated)
|
||||
0x89,
|
||||
0x50,
|
||||
0x4e,
|
||||
0x47,
|
||||
0x0d,
|
||||
0x0a,
|
||||
0x1a,
|
||||
0x0a, // PNG signature
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x0d, // IHDR chunk length
|
||||
0x49,
|
||||
0x48,
|
||||
0x44,
|
||||
0x52, // IHDR
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x02, // width: 2
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x01, // height: 1
|
||||
0x08,
|
||||
0x02, // bit depth, color type
|
||||
0x00,
|
||||
0x00,
|
||||
0x00, // compression, filter, interlace
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00, // CRC (not validated)
|
||||
]);
|
||||
|
||||
it("returns icon data for square PNG", async () => {
|
||||
|
||||
Reference in New Issue
Block a user