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

projectIconModel.test.ts

36 lines1.3 KB

1import { describe, expect, it } from "vite-plus/test";
2import { PROJECT_ICON_NAMES, selectProjectIcon } from "./projectIconModel";
3​
4describe("selectProjectIcon", () => {
5 it.each([
6 ["customer-api", "server"],
7 ["AnalyticsDatabase", "database"],
8 ["ios-client", "mobile"],
9 ["terraform-infra", "cloud"],
10 ["developer-docs", "book"],
11 ["shop-frontend", "shopping"],
12 ["agent-runtime", "ai"],
13 ["video-studio", "video"],
14 ] as const)("classifies %s as %s", (projectName, expectedIcon) => {
15 expect(selectProjectIcon(projectName, `/workspace/${projectName}`).icon).toBe(expectedIcon);
16 });
17​
18 it("uses the workspace directory when the project name is blank", () => {
19 expect(selectProjectIcon("", "C:\\work\\mobile-app").icon).toBe("mobile");
20 });
21​
22 it("uses Lucide icons for automatic project icons", () => {
23 expect(selectProjectIcon("agent-runtime", "/workspace/agent-runtime")).toEqual({
24 kind: "lucide",
25 icon: "ai",
26 });
27 });
28​
29 it("gives unknown names a stable generic icon", () => {
30 const icon = selectProjectIcon("mercury", "/workspace/mercury");
31​
32 expect(icon.kind).toBe("lucide");
33 expect(PROJECT_ICON_NAMES).toContain(icon.icon);
34 expect(selectProjectIcon("mercury", "/elsewhere/mercury")).toEqual(icon);
35 });
36});