mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-06 16:08:05 +00:00
15 lines
528 B
TypeScript
15 lines
528 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { relativeDir } from "./project";
|
|
|
|
describe("relativeDir", () => {
|
|
it("is empty for files directly in the project root", () => {
|
|
expect(relativeDir("/p/app", "/p/app/README.md")).toBe("");
|
|
});
|
|
it("is project-relative for nested files", () => {
|
|
expect(relativeDir("/p/app", "/p/app/src/lib/a.ts")).toBe("src/lib");
|
|
});
|
|
it("keeps the absolute directory outside the project", () => {
|
|
expect(relativeDir("/p/app", "/other/x.ts")).toBe("/other");
|
|
});
|
|
});
|