git-bash-path.test.ts 821 B

1234567891011121314
  1. import { describe, expect, it } from "vitest";
  2. import { gitBashPathToWindowsPath, windowsPathToGitBashPath } from "../src/path/git-bash.js";
  3. describe("Git Bash path helpers", () => {
  4. it("converts Windows and Git Bash paths in both directions", () => {
  5. expect(windowsPathToGitBashPath("C:\\repo\\sub")).toBe("/c/repo/sub");
  6. expect(windowsPathToGitBashPath("C:/repo/sub")).toBe("/c/repo/sub");
  7. expect(windowsPathToGitBashPath("C:repo\\sub")).toBe("C:repo/sub");
  8. expect(windowsPathToGitBashPath("\\\\server\\share\\repo")).toBe("//server/share/repo");
  9. expect(gitBashPathToWindowsPath("/c/repo/sub")).toBe("C:\\repo\\sub");
  10. expect(gitBashPathToWindowsPath("/cygdrive/d/repo")).toBe("D:\\repo");
  11. expect(gitBashPathToWindowsPath("//server/share/repo")).toBe("\\\\server\\share\\repo");
  12. });
  13. });