Something went wrong. Try again.
a reactive (signals based) hypermedia web framework (wip) stormlightlabs.github.io/volt
hypermedia frontend signals
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182import { findMonorepoRoot, getDocsPath, getExamplesPath, getLibPath, getLibSrcPath, getLibTestPath,} from "$utils/paths.js";import { existsSync } from "node:fs";import path from "node:path";import { describe, expect, it } from "vitest";
describe("path utilities", () => { it("should find monorepo root from cli directory", async () => { const root = await findMonorepoRoot(process.cwd());
expect(root).toBeTruthy(); expect(existsSync(path.join(root, "pnpm-workspace.yaml"))).toBe(true); });
it("should find lib package path", async () => { const libPath = await getLibPath();
expect(libPath).toBeTruthy(); expect(libPath).toContain("lib"); expect(existsSync(path.join(libPath, "package.json"))).toBe(true); });
it("should find lib src path", async () => { const srcPath = await getLibSrcPath();
expect(srcPath).toBeTruthy(); expect(srcPath).toContain("lib"); expect(srcPath).toContain("src"); expect(existsSync(srcPath)).toBe(true); });
it("should find lib test path", async () => { const testPath = await getLibTestPath();
expect(testPath).toBeTruthy(); expect(testPath).toContain("lib"); expect(testPath).toContain("test"); expect(existsSync(testPath)).toBe(true); });
it("should find docs package path", async () => { const docsPath = await getDocsPath();
expect(docsPath).toBeTruthy(); expect(docsPath).toContain("docs"); expect(existsSync(path.join(docsPath, "package.json"))).toBe(true); });
it("should find examples directory path", async () => { const examplesPath = await getExamplesPath();
expect(examplesPath).toBeTruthy(); expect(examplesPath).toContain("examples"); expect(existsSync(examplesPath)).toBe(true); });
it("should return consistent paths when called multiple times", async () => { const root1 = await findMonorepoRoot(); const root2 = await findMonorepoRoot();
expect(root1).toBe(root2);
const libPath1 = await getLibPath(); const libPath2 = await getLibPath();
expect(libPath1).toBe(libPath2); });
it("should handle being called from monorepo root", async () => { const root = await findMonorepoRoot(); const rootFromRoot = await findMonorepoRoot(root);
expect(root).toBe(rootFromRoot); });});