24 lines
810 B
TypeScript
24 lines
810 B
TypeScript
import { describe, expect, it } from "vite-plus/test";
|
|
|
|
import { fileBreadcrumbs } from "./filePath";
|
|
|
|
describe("fileBreadcrumbs", () => {
|
|
it("builds project, directory, and file crumbs", () => {
|
|
expect(fileBreadcrumbs("t3code", "apps/web/src/main.tsx")).toEqual([
|
|
{ label: "t3code", path: "", kind: "project" },
|
|
{ label: "apps", path: "apps", kind: "directory" },
|
|
{ label: "web", path: "apps/web", kind: "directory" },
|
|
{ label: "src", path: "apps/web/src", kind: "directory" },
|
|
{ label: "main.tsx", path: "apps/web/src/main.tsx", kind: "file" },
|
|
]);
|
|
});
|
|
|
|
it("normalizes repeated separators", () => {
|
|
expect(fileBreadcrumbs("workspace", "/src//index.ts").map((crumb) => crumb.label)).toEqual([
|
|
"workspace",
|
|
"src",
|
|
"index.ts",
|
|
]);
|
|
});
|
|
});
|