UNPKG

one

Version:

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

29 lines (28 loc) 1.71 kB
import { describe, expect, it } from "vitest"; import { toServerOutputPath } from "./toServerOutputPath.native.js"; describe("toServerOutputPath", function () { it("prepends ${outDir}/server/ to bare filenames from Vite output", function () { expect(toServerOutputPath("assets/loader-abc.js", "dist")).toBe("dist/server/assets/loader-abc.js"); }); it("prepends ${outDir}/server/ to project-relative paths from the route tree", function () { expect(toServerOutputPath("./pages/index.tsx", "dist")).toBe("dist/server/pages/index.tsx"); }); it("returns input unchanged when it is already rooted under ${outDir}/server/", function () { expect(toServerOutputPath("dist/server/assets/loader-abc.js", "dist")).toBe("dist/server/assets/loader-abc.js"); }); it("treats backslashes as separators on every platform (the Windows path-doubling case)", function () { expect(toServerOutputPath("dist\\server\\assets\\loader-abc.js", "dist")).toBe("dist/server/assets/loader-abc.js"); }); it("is idempotent: feeding the output back in returns the same value", function () { var first = toServerOutputPath("assets/loader-abc.js", "dist"); var second = toServerOutputPath(first, "dist"); expect(second).toBe(first); }); it("honors a custom outDir", function () { expect(toServerOutputPath("assets/loader.js", "build")).toBe("build/server/assets/loader.js"); }); it("does not false-positive on inputs that contain ${outDir}/server as a substring but are not rooted under it", function () { expect(toServerOutputPath("foo/dist/server/bar.js", "dist")).toBe("dist/server/foo/dist/server/bar.js"); }); }); //# sourceMappingURL=toServerOutputPath.test.native.js.map