mirror of
https://github.com/morluto/rea.git
synced 2026-11-02 21:06:04 +00:00
29 lines
765 B
TypeScript
29 lines
765 B
TypeScript
import { isAbsolute } from "node:path";
|
|
|
|
import { expect, it } from "vitest";
|
|
|
|
import { absoluteLocalPathStringSchema } from "./localPath.js";
|
|
|
|
it("matches the host path module for absolute local paths", () => {
|
|
for (const path of [
|
|
"/absolute/path",
|
|
"/",
|
|
"relative/path",
|
|
"C:\\absolute\\path",
|
|
"c:/absolute/path",
|
|
"C:relative/path",
|
|
"\\\\server\\share\\path",
|
|
"\\rooted\\path",
|
|
"//server/share/path",
|
|
"file:///absolute/path",
|
|
]) {
|
|
expect(absoluteLocalPathStringSchema.safeParse(path).success).toBe(
|
|
isAbsolute(path),
|
|
);
|
|
}
|
|
expect(absoluteLocalPathStringSchema.safeParse("").success).toBe(false);
|
|
expect(
|
|
absoluteLocalPathStringSchema.safeParse("/absolute/with\0nul").success,
|
|
).toBe(false);
|
|
});
|