UNPKG

one

Version:

One is a new React Framework that makes Vite serve both native and web.

27 lines (26 loc) 1.39 kB
import { describe, expect, it } from "vitest"; import { getSourceInspectorPath, resolveEditorFilePath } from "./sourceInspectorPlugin.native.js"; describe("sourceInspectorPlugin helpers", function () { describe("getSourceInspectorPath", function () { it("keeps project files relative to the current cwd", function () { expect(getSourceInspectorPath("/repo/packages/one/src/App.tsx", "/repo")).toBe("/packages/one/src/App.tsx"); }); it("does not strip matching path prefixes from files outside cwd", function () { expect(getSourceInspectorPath("/repo-other/packages/one/src/App.tsx", "/repo")).toBe("/repo-other/packages/one/src/App.tsx"); }); }); describe("resolveEditorFilePath", function () { it("resolves project-relative source paths against cwd", function () { var fileExists = function (filePath) { return filePath === "/repo/packages/one/src/App.tsx"; }; expect(resolveEditorFilePath("/packages/one/src/App.tsx", "/repo", fileExists)).toBe("/repo/packages/one/src/App.tsx"); }); it("preserves absolute source paths for files outside cwd", function () { expect(resolveEditorFilePath("/Users/n8/shared/ui/Button.tsx", "/repo/apps/site", function () { return false; })).toBe("/Users/n8/shared/ui/Button.tsx"); }); }); }); //# sourceMappingURL=sourceInspectorPlugin.test.native.js.map