Open History to see the last commit
1import { assert, describe, it } from "vite-plus/test";
2
3import { resolvePierreIconForEntry, T3_PIERRE_ICONS } from "./pierre-icons";
4
5describe("Pierre file icons", () => {
6 it("uses detected types for extensionless files while keeping known filename icons", () => {
7 assert.equal(
8 resolvePierreIconForEntry("custom-script", "file", "text/x-python")?.token,
9 "python",
10 );
11 assert.equal(resolvePierreIconForEntry("image", "file", "image/png")?.token, "image");
12 assert.equal(
13 resolvePierreIconForEntry("Dockerfile", "file", "text/x-shellscript")?.token,
14 "docker",
15 );
16 assert.isNull(resolvePierreIconForEntry("folder.png", "directory", "image/png"));
17 assert.equal(
18 resolvePierreIconForEntry("unknown", "file", "application/octet-stream")?.token,
19 "default",
20 );
21 });
22
23 it("ships every custom icon referenced by the extended resolver", () => {
24 const customIconNames = new Set(
25 [
26 ...Object.values(T3_PIERRE_ICONS.byFileName),
27 ...Object.values(T3_PIERRE_ICONS.byFileExtension),
28 ].filter((name) => name.startsWith("t3-")),
29 );
30 for (const iconName of customIconNames) {
31 assert.include(T3_PIERRE_ICONS.spriteSheet, `id="${iconName}"`);
32 }
33 });
34});