Open History to see the last commit
1import { describe, expect, it } from "vite-plus/test";
2
3import { fileBreadcrumbs } from "./filePath";
4
5describe("fileBreadcrumbs", () => {
6 it("builds project, directory, and file crumbs", () => {
7 expect(fileBreadcrumbs("t3code", "apps/web/src/main.tsx")).toEqual([
8 { label: "t3code", path: "", kind: "project" },
9 { label: "apps", path: "apps", kind: "directory" },
10 { label: "web", path: "apps/web", kind: "directory" },
11 { label: "src", path: "apps/web/src", kind: "directory" },
12 { label: "main.tsx", path: "apps/web/src/main.tsx", kind: "file" },
13 ]);
14 });
15
16 it("normalizes repeated separators", () => {
17 expect(fileBreadcrumbs("workspace", "/src//index.ts").map((crumb) => crumb.label)).toEqual([
18 "workspace",
19 "src",
20 "index.ts",
21 ]);
22 });
23});