Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

projectIconOptions.test.ts

35 lines1.5 KB

1import { AlarmClockCheck, ArrowDown01, Layers3 } from "lucide-react";
2import { describe, expect, it } from "vite-plus/test";
3import { lucideIconByName } from "./lib/lucideIconByName";
4import {
5 filterProjectIconNames,
6 firstEmoji,
7 projectIconColorClassName,
8} from "./projectIconOptions";
9​
10describe("projectIconOptions", () => {
11 it("searches across the full Lucide set", () => {
12 expect(filterProjectIconNames("alarm clock")).toContain("alarm-clock");
13 expect(filterProjectIconNames("alarm \tclock")).toContain("alarm-clock");
14 });
15​
16 it("resolves every offered icon name, including saved legacy spellings", () => {
17 for (const name of filterProjectIconNames("")) expect(lucideIconByName(name)).toBeDefined();
18 expect(lucideIconByName("layers-3")).toBe(Layers3);
19 expect(lucideIconByName("arrow-down-01")).toBe(ArrowDown01);
20 expect(lucideIconByName("arrow-down-0-1")).toBe(ArrowDown01);
21 expect(lucideIconByName("alarm-check")).toBe(AlarmClockCheck);
22 expect(lucideIconByName("create-lucide-icon")).toBeUndefined();
23 });
24​
25 it("extracts one complete emoji grapheme", () => {
26 expect(firstEmoji(" 👩🏽‍💻 hello")).toBe("👩🏽‍💻");
27 expect(firstEmoji("🇺🇸 project")).toBe("🇺🇸");
28 expect(firstEmoji("1️⃣ project")).toBe("1️⃣");
29 expect(firstEmoji("plain text")).toBeNull();
30 });
31​
32 it("maps persisted colors to theme-aware classes", () => {
33 expect(projectIconColorClassName("violet")).toBe("text-violet-600 dark:text-violet-400");
34 });
35});