34 lines · 1.1 KB · TypeScript
RawDownload
import { describe, expect, it } from "vite-plus/test";import {  isExplicitRelativePath,  isUncPath,  isWindowsAbsolutePath,  isWindowsDrivePath,} from "./path.ts"; describe("path helpers", () => {  it("detects windows drive paths", () => {    expect(isWindowsDrivePath("C:\\repo")).toBe(true);    expect(isWindowsDrivePath("D:/repo")).toBe(true);    expect(isWindowsDrivePath("/repo")).toBe(false);  });   it("detects UNC paths", () => {    expect(isUncPath("\\\\server\\share\\repo")).toBe(true);    expect(isUncPath("C:\\repo")).toBe(false);  });   it("detects windows absolute paths", () => {    expect(isWindowsAbsolutePath("C:\\repo")).toBe(true);    expect(isWindowsAbsolutePath("\\\\server\\share\\repo")).toBe(true);    expect(isWindowsAbsolutePath("./repo")).toBe(false);  });   it("detects explicit relative paths", () => {    expect(isExplicitRelativePath(".")).toBe(true);    expect(isExplicitRelativePath("..")).toBe(true);    expect(isExplicitRelativePath("./repo")).toBe(true);    expect(isExplicitRelativePath("..\\repo")).toBe(true);    expect(isExplicitRelativePath("~/repo")).toBe(false);  });});

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t